I changed my code so that after the SQL Server job is finished, I copy the log to where I want to put the results. Both before and after the copy, I used your loop to
1) make sure the source file was ready
2) make sure the copied file was completely copied
Code: Select all
//make sure the job log is ready
Let>wres=1
Let>WLN_NOCRLF=1
While>wres<>0
WriteLn>v_job_log,wres,
Wait>0.01
EndWhile>
Let>WLN_NOCRLF=0
//now copy it to the results folder
CopyFile>v_job_log,v_job_log_copy
Let>wres=1
Let>WLN_NOCRLF=1
While>wres<>0
WriteLn>v_job_log_copy,wres,
Wait>0.01
EndWhile>
Let>WLN_NOCRLF=0
then I do the rest, and rather than delete the temp files, I kept them so that I could see where the encoding was introduced. The job log is fine. The copied job log is fine. The encoding gets introduced when the job log is appended to the data file. It begins at step 4 below, and everything below it has the same problem.
The process is basically this:
1) copy the job log to the results folder
2) copy the data file to the results folder
3) append a blank space text file to the data file
4) append the job log to the data file
Code: Select all
Let>WLN_NOCRLF=0
//add the job log to another temp file
AppendFile>%v_archive%_2,v_job_log_copy,%v_archive%_3,v_bytes_written
Let>wres=1
Let>WLN_NOCRLF=1
While>wres<>0
WriteLn>%v_archive%_3,wres,
Wait>0.01
EndWhile>
Let>WLN_NOCRLF=0
5) append job done file to the data file
6) append job evaluation to the data file
Finally, this is what I see when I look at it. You can see the character that's been introduced by the append. Notice how the line above doesn't have the spaces. That's the data file + blank file. Oh, and yes, I did look in the blank text file to make sure it wasn't added at the end.

"A facility for quotation covers the absence of original thought." - Lord Peter Wimsey