November 8, 2002 at 5:09 pm
I have received some data via FTP from an AS/400. I can read the fields that are in CHAR format, but cannot read the values in PACK format. It appears that each 2 characters in the numeric format are somehow packed into 1 byte. Anyone know how to read this format?
November 11, 2002 at 8:00 am
This was removed by the editor as SPAM
November 11, 2002 at 1:09 pm
I looked at this and find no details on a method that can be readily incorporated. However, I did see on the IBM site a C header whre you can program an unpack utility. Haven't looked much at it since I don't have an example. Let me know and I can send you the link if you want to give it a whirl.
November 11, 2002 at 3:17 pm
What your dealing with is a standard EBCDIC to ASCII translation. There are many different flavors of this, but do a search for "EBCDIC to ASCII" and you'll get tons of info.
If your just dealing with packed signed decimals, I have scripts I'll post for you. If your dealing with more than that, good luck, you'll need it. Even the translation programs I've dealt with only hit around 97% accurate in converting the data I had. Best scenario is to get them to un-pack it on the AS/400 side.
December 3, 2002 at 9:13 pm
IBM Packed data stores numeric data by setting each 4-bytes to a number from 0-9. You get an exact number this way, no estimates, no abouts and it takes 50% of the space of storing the data in character format. The rightmost half-byte stores the sign of the number. I forget exactly all the possible values but I know 0x0F as the sign is POSITIVE. I think 0x0C is NEGATIVE but don't hold me to it.
In storage 123456 packed would appear as 0x0123456F. using the bitwise AND operator (&) you can construct a routine (i suggest a user defined function) that loops through each byte, processes each nibble (half byte) and sums the result.
It would be some good code to post.
December 4, 2002 at 9:57 pm
quote:
Anyone know how to read this format?
I just posted Pack() and Unpack() user-defined functions. As soon as the admin approves them, you can download them and go to town (don't forget to vote!)
Edited by - don1941 on 12/05/2002 07:17:29 AM
December 4, 2002 at 10:23 pm
If they work as you say, you'll make me a VERY happy person as well. What I have to use is pretty ugly. A function makes it even better. I'll be a fan for life (or at least until my next contract.....)
January 10, 2003 at 9:16 am
Ok, maybe I'm braindead, but how do I find these UDF's on this site? Did the Admins approve them? I'm in dire need of this functionality.
Thanks,
Michelle
Michelle
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy