2006 Jul 25 4:44 PM
Hello,
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
C X-UNKNOWN
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.
Thanks,
Bob
2006 Jul 25 6:33 PM
Can you move the XML_TAB line to a single field (say ws_line(80) type c) and write this to the file? It might be due to a structure being transferred in binary mode.
Let us know how it goes.
2006 Jul 25 7:18 PM
Hi Bob,
Use CLEAR statement after TRANSFER statement and check once.
IF LIN EQ 0.
EXIT.
ELSE.
LOOP AT XML_TAB.
TRANSFER XML_TAB TO P_APPFIL.
<b>CLEAR XML_TAB.</b>
ENDLOOP.
ENDIF.
Thanks,
Vinay
2006 Jul 25 9:41 PM
I feel that it must be something that is happening when the last line is transferred. I ran the same variant 4 more times and it did not add any of the extra data. Other times when this was in our quality system, I ran the program several times with using the same variant, and each time it added something different on the last line. Our EDI person created a script to remove this at the unix level, but I would like to find the how and why this happens
2006 Jul 25 10:14 PM
Use Length option in TRANSFER statement.
Calculate last line length using strlen() and ue the length in the transfer statement.
Regards
Sridhar
2006 Jul 26 8:28 PM
Hi,
I tried this but since the data line is hex it always comes up with a length of 256 ( DATA: XML TYPE DCXMLLINES )