View previous topic :: View next topic |
Author |
Message |
Manas Biswal Intermediate
Joined: 29 Nov 2002 Posts: 382 Topics: 27 Location: Chennai, India
|
Posted: Thu Feb 20, 2003 7:59 am Post subject: Packed Format |
|
|
Hi,
I just needed to know whether it is possible to read and interpret packed data outside mainframe. What I mean is that suppose I have a seq dataset containing packed data and I download it to my local PC in a text file. Is it possible to convert the packed data to character format using any sort of Xref. Is there any such Xref available using which I can convert the packed data to its corresponding character format.
Regards,
Manas |
|
Back to top |
|
|
RonB Beginner
Joined: 02 Dec 2002 Posts: 93 Topics: 0 Location: Orlando, FL
|
Posted: Thu Feb 20, 2003 10:39 am Post subject: |
|
|
The problem is that a TEXT download of data requires a translation from EBCDIC to ASCII, and that requires tables that vary depending on what mechanism / vendor package is being used to do the download. Since packed data can consist of data bytes with EBCDIC hex values from 00-09, 10-19, 20-29, etc., as well as 1C, 1D, 1F, 2C, 2D, 2F, etc., you would need to know exactly what ASCII hex values those would translate to during the download.
Ron _________________ A computer once beat me at chess, but it was no match for me at kick boxing. |
|
Back to top |
|
|
Manas Biswal Intermediate
Joined: 29 Nov 2002 Posts: 382 Topics: 27 Location: Chennai, India
|
Posted: Fri Feb 21, 2003 3:29 am Post subject: |
|
|
Hi Ron,
There is no problem in conversion of EBCDIC to ASCII. Almost all the FTP packages can handle that. As far as I understand, what you mean to say is that if we know exactly the ASCII hex values(that the FTP transalates to) that correspond to the EBCDIC hex values in the mainframe, we can write a generic routine that can read the data byte by byte and convert it to text.
Please confirm this assumption of mine.
Regards,
Manas |
|
Back to top |
|
|
RonB Beginner
Joined: 02 Dec 2002 Posts: 93 Topics: 0 Location: Orlando, FL
|
Posted: Fri Feb 21, 2003 11:45 am Post subject: |
|
|
Right you are, Manas. E.G. if EBCDIC x'12' always translates to ASCII x'b2' then all that is needed is to 'untranslate' x'b2' to = text '12'. Be sure to allow for the last byte having a sign - e.g. if EBCDIC x'4d' always translates to ASCII x'ed', then it must be 'untranslated' as text '4' AND the numeric value of the entire 'untranslated' field must be negated.
Ron _________________ A computer once beat me at chess, but it was no match for me at kick boxing. |
|
Back to top |
|
|
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Sat Feb 22, 2003 1:08 pm Post subject: |
|
|
Nope. One of the translations that FTP does in a text download (ascii, ebcdic, whatever), is modification of the carriage return line feeds. If your packed data happens to look like a carriage return or line feed, it may be changed or lost completely. You'll have to use binary. It doesn't make sense to take a binary field. translate it to ascii and back. Not only are special characters lost, but use of a different code page will destroy other characters. |
|
Back to top |
|
|
warp5 Intermediate
Joined: 02 Dec 2002 Posts: 429 Topics: 18 Location: Germany
|
Posted: Mon Feb 24, 2003 1:49 am Post subject: |
|
|
Actually, the best bet would be to change those packed fields to unpacked on the mainframe and then transfer the dataset. You can use sort or other utilities to do this. Like semigeezer says, otherwise you will have to transfer binary and do all the work translating to ascii on your pc, which will be a hassle. |
|
Back to top |
|
|
|
|