Operating System - HP-UX
1824976 Members
3392 Online
109678 Solutions
New Discussion юеВ

Unpacking Packed COMP-3/binary data from Mainframe

 
Vinayak Shet
New Member

Unpacking Packed COMP-3/binary data from Mainframe

Hi All,
I have a Mainframe file which has the following format

f1f2p1p2f3
where f1,f2,f3 are simple charater data
and p1,p2 are packed data in COMP-3 format

My task is to get this file on Unix and unpack the packed data using any C routine or anything else so that I can create a new file with the character fields remaining as it is and the packed data unpacked to ascii format.

Can anyone help me with this.


Thanks,
Vinayak
3 REPLIES 3
James R. Ferguson
Acclaimed Contributor

Re: Unpacking Packed COMP-3/binary data from Mainframe

Hi:

I'd unpack the file *on* the mainframe into a new file which is then ftp'd as character data to the Unix server.

If necessary use 'dd' to unblock and convert EBCDIC to ASCII. See the man pages for 'dd' for more information.

Regards!

...JRF...

Vinayak Shet
New Member

Re: Unpacking Packed COMP-3/binary data from Mainframe

We can't unpack the file on the mainframe side since we dont have a resource to do it. Thats the reason we have to first bring the file on Unix and then unpack the packed comp-3 fields.

Do you know of any routine in C whic will unpack the COMP-3 packed data.

Thanks,
Vinayak
John Poff
Honored Contributor

Re: Unpacking Packed COMP-3/binary data from Mainframe

Hi,

Here is a link to a page that talks about handling COMP3 binary data. The page agrees with what James said, that it is better to try to unpack the field on the mainframe side, but if you can't do that they have some sample Java code to try to unpack a COMP3 field.

http://www.room42.com/store/computer_center/packed_decimal.shtml

Good luck!

JP