THE SHORT ANSWER
Almost always the file was transferred as text, so every byte was converted as if it were a character. A packed (COMP-3) field is binary data, and IBM's table of recommended transfer methods lists Image (binary) for binary data between ASCII and EBCDIC hosts. IBM also warns that information could be lost or altered if you use an incorrect transfer.
Steps
- Compare the bytes. Look at the same field in hex on the mainframe and after the transfer. If the bytes differ, the transfer changed them.
- Check the transfer type your client used. IBM's table of recommended transfer methods lists Image (binary) for binary data, so a packed field should not travel as a text transfer.
- Send the file again as binary. Set the transfer type to Image (binary) before the transfer, for the whole file.
- Mind the record layout. Variable-length files carry a 4-byte descriptor in front of each record; see the RDW guide, and check how your tool keeps or drops it.
- Decode with the copybook. After a binary transfer the text fields are still EBCDIC. Open the file with a tool that reads EBCDIC and the copybook, then compare a few records with the mainframe.
Worked example: what a text conversion does to three bytes
The Kit's own illustration (not an IBM statement): a packed +12345 (PIC S9(5) COMP-3) is X'12345C'. If a conversion from EBCDIC code page 037 to characters changed it, using the Kit's code page 037 table:
BEFORE 12 34 5C -> 12345
AFTER 12 94 2A -> 12942 (a valid but wrong number)With these invented bytes no error appears: the new bytes still read as a packed number, just the wrong one. This is an illustration with the Kit's code page 037 table; a real client's conversion may differ, so always compare the bytes themselves (step 1).
Related: S0C7 data exception · EBCDIC converter · Packed decimal calculator · Packed decimal and S0C7 (Mainframe Path)
Sources, checked : How to transfer data with FTP, z/OS 3.2.0 Communications Server; Formats for numeric data, Enterprise COBOL for z/OS 6.5.0. Explanations are in our own words; the worked example is invented. Confirm against IBM documentation before changing production systems. mainframekit.com/guides/packed-field-garbage-after-ftp/