× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



    Hi Bob,

    You need to bring the file across as binary and then do a field by field
conversion using the String and
com.ibm.as400.access.AS400PackedDecimal classes.

    If you bring it down as text, each byte, typically, is converted to
ASCII.  That doesn't work for true numeric fields because they aren't
characters but binary values that don't map to a character set.  The same is
true for a non-EBCDIC file that contains numbers and characters, and is why
trying to just use an encoding translation on that kind of file doesn't
work.

    As Mark indicated, BinaryConverter doesn't understand that C, D and/or F
are sign indicators and takes them at their hex value.  While we are
accustomed to 'F' for positive values on the '400, 'C' is an explicit
positive used often on mainframes.  If my recollection is correct, any value
other than 'D' is taken as positive.

    Have fun,


                                                         Joe Sam

Joe Sam Shirah -        http://www.conceptgo.com
conceptGO         -        Consulting/Development/Outsourcing
Java Filter Forum:       http://www.ibm.com/developerworks/java/
Just the JDBC FAQs: http://www.jguru.com/faq/JDBC
Going International?    http://www.jguru.com/faq/I18N
Que Java400?             http://www.jguru.com/faq/Java400


----- Original Message -----
From: "Bob Szemethy" <b.szemethy@xxxxxxxxxxx>
To: <java400-l@xxxxxxxxxxxx>
Sent: Monday, August 23, 2004 10:51 PM
Subject: Help w/ Packed Decimal


> Hi all -
>
> A quick question about a flat file built on a S/390, that I am trying to
> process on a Windows box using JTOpen.
>
> I have access to the file only though an FTP applet that our HQ
> maintains, and I pulled the file down as text and as binary.  When I'm
> processing the file, I have no trouble with the text fields, but there
> are some packed decimal fields that are not coming across.
>
> I also was able to parse the binary file when I set the encoding to
> "IBM1047", but had the same problem with the packed fileds.
>
> I tried the BinaryConverter class, and the method to convert to Hex
> string for the byte array, and for the text and binary files, it returns
> the following sting for a 4 byte number : "0000000C", which I understand
> to be 12, but I know the number should be 1.
>
> So my question is this:  Can I parse a packed-decimal field in a file
> that has been translated to ASCII or Unicode?  Thanks for any help.
>
> Bob
>







As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.