Transferring packed PC numbers into the AS/400

Transferring packed PC numbers into the AS/400

Post by Lito Sandieg » Fri, 15 Oct 1999 04:00:00



We have a Windows NT machine that needs to send data over to the AS/400. When we tested it via FTP, we found out that the packed data did not 'map' correctly -- only the text fields are readable. I did a little research and it turned out that there is no way for the 400 to accept packed numeric data via FTP. Would someone know of a workaround on this problem? I know that converting the packed numbers to printable form before transfer is one of the best ways to get around this, but we can only consider that option if there's no other viable solution available.

Thanks in advance,

Lito Sandiego
Senior Systems Analyst
IMR Global

 
 
 

Transferring packed PC numbers into the AS/400

Post by Tim » Fri, 15 Oct 1999 04:00:00


Actually the AS400 is one of the very few platforms that *CAN* accept packed
decimal only if the data is transmitted in EBCDIC, or if binary mode is used
and the data is ebcidic data.

But I suspect what you really have is an ASCII fixed file that you want to
transfer into an AS/400 database record that contains packed data. And I am
afraid you are kind of stuck with the solution you don't want to try...


Quote:> We have a Windows NT machine that needs to send data over to the AS/400.

When we tested it via FTP, we found out that the packed data did not 'map'
correctly -- only the text fields are readable. I did a little research and
it turned out that there is no way for the 400 to accept packed numeric data
via FTP. Would someone know of a workaround on this problem? I know that
converting the packed numbers to printable form before transfer is one of
the best ways to get around this, but we can only consider that option if
there's no other viable solution available.
Quote:

> Thanks in advance,

> Lito Sandiego
> Senior Systems Analyst
> IMR Global


 
 
 

Transferring packed PC numbers into the AS/400

Post by Lito Sandieg » Sat, 16 Oct 1999 04:00:00


Would Client Access work in this case? We DO
actually have ASCII files on the NT server (this
file comes from POS/VAX machines from all across
the country) that have packed numeric data. I was
wondering that if we define the FDF correctly,
then would the packed numbers become
honest-to-goodness-EBCDIC-AS/400-readable data?

Thanks in advance again,

Lito Sandiego

 
 
 

Transferring packed PC numbers into the AS/400

Post by Jim Langsto » Sat, 16 Oct 1999 04:00:00


Intel packed numbers are stored quite differently than OS/400's packed numbers.  Intel reverses the order of the bytes in numbers whereas windows doesn't.  Instead of saving the numbers low byte then high byte, (or vice versa, I don't remember which) it stores them high byte then low byte.

Also, packed numbers in the AS/400 seem to use BCD as far as I can tell, and not true integers.  We know that a packed number on the AS/400 takes 1 nibble per character and one for the sign (a nibble is half a byte).  Intel packed integers, on the other hand, do not use BCD but use machine integers.  One byte (8 bits) in BCD can hold 0 to 9 in one nibble, or -9 to +9, Intel integers, on the other hand, can hold -128 to 127.  One of the reasons is Intel only uses one bit (the high bit) for the sign, leaving 7 bits for the number.  In two bytes (4 nibbles) BCD
gives us -999 to +999 yet Intel gives us -32768 to +32767.

It should be possible to read these Intel numbers, either on the PC or the AS/400, and convert them to OS/400's BCD with bit math.

Regards,

Jim Langston


> We have a Windows NT machine that needs to send data over to the AS/400. When we tested it via FTP, we found out that the packed data did not 'map' correctly -- only the text fields are readable. I did a little research and it turned out that there is no way for the 400 to accept packed numeric data via FTP. Would someone know of a workaround on this problem? I know that converting the packed numbers to printable form before transfer is one of the best ways to get around this, but we can only consider that option if there's no other viable solution available.

> Thanks in advance,

> Lito Sandiego
> Senior Systems Analyst
> IMR Global

 
 
 

Transferring packed PC numbers into the AS/400

Post by Paul Nicola » Tue, 19 Oct 1999 04:00:00


Jim,

What you're referring to are not packed fields, but binary ones (which also
give the -32768 to 32767 range for two bytes) or even the new Integer data
types which exist in ILE-RPG.

Regards,
Paul
-----------------
Intel packed numbers are stored quite differently than OS/400's packed
numbers.  Intel reverses the order of the bytes in numbers whereas windows
doesn't.  Instead of saving the numbers low byte then high byte, (or vice
versa, I don't remember which) it stores them high byte then low byte.

Also, packed numbers in the AS/400 seem to use BCD as far as I can tell, and
not true integers.  We know that a packed number on the AS/400 takes 1
nibble per character and one for the sign (a nibble is half a byte).  Intel
packed integers, on the other hand, do not use BCD but use machine integers.
One byte (8 bits) in BCD can hold 0 to 9 in one nibble, or -9 to +9, Intel
integers, on the other hand, can hold -128 to 127.  One of the reasons is
Intel only uses one bit (the high bit) for the sign, leaving 7 bits for the
number.  In two bytes (4 nibbles) BCD
gives us -999 to +999 yet Intel gives us -32768 to +32767.

It should be possible to read these Intel numbers, either on the PC or the
AS/400, and convert them to OS/400's BCD with bit math.

Regards,

Jim Langston

       The contents of this message express only the sender's opinion.
       This message does not necessarily reflect the policy or views of
       my employer, Merck & Co., Inc.  All responsibility for the statements
       made in this Usenet posting resides solely and completely with the
       sender.