I am getting random bad data being added to the end of the file that is created on the file server when I run the Open Dataset for output in Binary mode. This data sometimes looks like information about the Unix file server. If I do the Open Dataset in Text mode, it does not add the extra bad data.
** transfer file to Unix File server DATA: LIN TYPE P. OPEN DATASET P_APPFIL FOR OUTPUT IN BINARY MODE. DESCRIBE TABLE XML_TAB LINES LIN. IF LIN EQ 0. EXIT. ELSE. LOOP AT XML_TAB. TRANSFER XML_TAB TO P_APPFIL. ENDLOOP. ENDIF. CLOSE DATASET P_APPFIL.
Running the program 2 times with the same variant will give different results.
For example, the data in file should end with </cPedigreeXML> but it added data as shown below:
</cPedigreeXML>8 I X-UNKNOWN 9 I X-UNKNOWN 10
Then, when the program was run again with the same selections, it did not add the erroneous data at the end.
This is a real problem because the bad data that gets added causes the file to error in the application. Any help would be greatly appreciated.