I have a batch that uses the record mapper class .I would like to have a custom operation that will write this batch to a csv file .My operation has a batch as its request and I would like to read that batch data to a csv.So far here is what I have.
Method BatchFile(pRequest As ResponseRBAT, Output pResponse As EnsLib.RecordMap.BatchResponse) As %Status
{
#dim status as %Status=$$$OK
#dim inrec as HSCIC.DBS.ResponseRMAP.Record=##class(ResponseRMAP.Record).%New()
set x=0
set:$$$ISOK(status) status= ..Adapter.PutLine(pRequest.%Source,pRequest.BatchHeader)
//set pRequest.Records.Count()
while (x<pRequest.Records.Count())
{
set inrec.ResponseCode=pRequest.Records.GetAt(1)
set inrec.PatientID =pRequest.Records.GetAt(2)
set inrec.MultiMatch =pRequest.Records.GetAt(3)
set:$$$ISOK(status) status= ..Adapter.PutLine(pRequest.%Source,inrec)
set x=$INCREMENT(x)
}
set:$$$ISOK(status) status= ..Adapter.PutLine(pRequest.%Source,pRequest.BatchTrailer)
$$$TRACE($System.Status.GetErrorText(status))
return status
} 


