Page 1 of 1

FTP file with packed decimals.

Posted: Sat May 21, 2016 7:53 pm
by Jyoti Chibber
Hi,
I have transferred a file from mainframe to a notepad. When I opened the notepad, I see all junk in the packed decimal fields. I am not sure how can I get it not to become junk, so I am thinking of writing a cobol program. But when we change the packed decimals to numeric displayable data the file length will increase, whcih I do not want to happen. How can I transfer a packed decimal in a numeric value. Please help me on this.
Regards,

Re: FTP file with packed decimals.

Posted: Sat May 21, 2016 8:12 pm
by Robert Sample
You have three choices:

1.  write a program in the language / utility of your choice (SORT can do it) to convert the packed-decimal data to zoned decimal (WHICH INCREASES THE LENGTH OF EACH RECORD) and send the converted data set to your PC since a PC cannot handle packed decimal data correctly

2.  transfer the data set as BINARY to your PC and write a conversion program on the PC in the language of your choice.  Your program will need to convert EBCDIC to ASCII as well as unpack the packed decimal data

3.  abandon the effort to transfer the data to your PC.  Packed decimal data CANNOT be transferred as text without causing data problems, and it cannot be unpacked without the length increasing (since packed decimal stores 2 decimal digits per byte, except for the last byte having the sign, you can double the length of each packed decimal field to estimate how long the record would grow).
In other words, your requirement to unpack the packed decimal values and your requirement to not increase the record length are in conflict -- one of them will NOT be met, and if you don't unpack the data you cannot put it on a PC and expect the data to be usable.

Re: FTP file with packed decimals.

Posted: Sun May 22, 2016 7:50 pm
by Akatsukami
There is a fourth theoretical possibility: write code to handle packed decimal fields on the PC. It could be done in Java or C++; however, it requires a level of understanding that no one in your organization may have.

Re: FTP file with packed decimals.

Posted: Thu Jul 21, 2016 2:11 pm
by Jyoti Chibber
Thanks all. I used SORT to convert data to readbale format on mainframes and then transferred the data to PC. That solved the problem.