First I am retrieving rows in a script and then I am using dw_1.SaveAsFormattedText(l
","'") to write a text file.
This text file is read by a batch prog every hour. The file has to be comma separated. the problem is I have to use this function b/c the rows may contain non alphabet charac like &,*,% etc due to bad data input The batch prog rejects the whole file even if one rec or line contains these special charac. so I have to wrap each value in Quotes. The function works OK except for the fact that it adds comma at the end of each line for some reason and that's why the file gets rejected. I am attaching the file.
One more problem is even if we remove the comma at the end of each line some fields like name contain comma inside due to bad data input again the file gets rejected. Please this is urgent
lds_client.dataobject = 'ds_dnd_client'
ll_rowcount = lds_client.Retrieve()
lb_exists = FileExists(ls_emp_path)
IF lb_exists THEN
if lds_client.SaveAsFormattedText(ls_emp_path,EncodingANSI!,",","'")= -1 then
MessageBox("ARCS Error","Error occurred saving the Employee file.")
ll_FLength = FileLength64(ls_emp_path)
li_FileNum = FileOpen(ls_emp_path,textmode!)
ll_fileread = FileReadEx(li_FileNum, ls_Emp_Input)
ls_Emp_Input = "F1,F2,F3,F4,F5~r~n" + ls_Emp_Input
li_FileNum = FileOpen(ls_emp_path, textmode!, Write!, LockWrite!, replace!)
ll_filewrite = FileWriteEx(li_FileNum, ls_Emp_Input)