FTP file with packed decimals.

Other Mainframe related questions which attracts you and there is no suitable Forum you find for it and related FAQs.
Post Reply
Jyoti Chibber
Registered Member
Posts: 16
Joined: Wed Aug 20, 2014 5:40 pm

FTP file with packed decimals.

Post 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,
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1886
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: FTP file with packed decimals.

Post 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.
User avatar
Akatsukami
Global Moderator
Global Moderator
Posts: 122
Joined: Tue Oct 20, 2015 3:20 am
Location: Bloomington, IL
Contact:

Re: FTP file with packed decimals.

Post 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.
"I come to the conclusion that, men loving according to their own will and fearing according to that of the prince, a wise prince should establish himself on that which is in his own control and not in that of others." -- Niccolò Machiavelli
Jyoti Chibber
Registered Member
Posts: 16
Joined: Wed Aug 20, 2014 5:40 pm

Re: FTP file with packed decimals.

Post 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.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “Other Mainframe Topics, Off-Topics, FAQs.”