Function FIND_RDS_ERROR() #pragma precomp SRP_PreCompiler equ crlf$ to \0D0A\ equ tab$ to char(09) equ comma$ to char(44) equ space$ to char(32) equ record$ to char(00) open "COC" to hCOC else status = Set_FSError() end fileToWrite = "D:\apps\LogFiles\Export\RDS_Errors.csv" CURSOR_NO = "" indexer = 0 Select "COC" By "SEQ" Setting CURSOR_NO Else status = Set_FSError() Return end Done = 0 index = 0 FailedRDSs = '' lastByte = 0 OSOpen fileToWrite To hFile then loop ReadNext @ID Using CURSOR_NO else Done = 1 Until Done Do read @RECORD From hCOC, @ID then /*if @ID EQ 154080 then debug end*/ COCRec = @RECORD RDSNos = DCOUNT(COCRec<8>, @VM) CassNos = DCOUNT(COCRec<34>,@VM) ShipNo = @ID WO_NO = COCRec<4> ReactType = COCRec<44> DatePicked = OCONV(COCRec<18>, 'DT4/') if (CassNos NE RDSNos) OR (RDSNos EQ 0) then *if RDSNos NE '' then if ReactType NE 'EPP' then index = index + 1 FailedRDSs = WO_NO FailedRDSs = DatePicked line = ShipNo: ',': WO_NO : ',' : DatePicked : CRLF$ OSBWrite line On hFile At lastByte lastByte = lastByte + Len(line) end *end end *jonathan = {RDS_NO} *test = {CASS_NO} *array(indexer) = @Record *swap @rm with record$ in array(indexer) *swap @fm with comma$ in array(indexer) *swap @vm with space$ in array(indexer) *indexer = indexer + 1 end * processing logic here ... *GoSub PROCESS Repeat osclose hFile end