× 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 Charlie,

    By effectively using a proprietary format, that somebody has shut out
the data from standard SQL or even Query, and caused additional work in
every program that wants to use it.

    The way I would approach the problem is to use ResultSet's
getBinaryStream() or getBytes() on the column.  I think that would work.  If
not, you'll have to retrieve it as a String, then try to convert back from
the Unicode attempt to EBCDIC.  The conversion to String may lose data.

    Once you have the raw data, you will either have to know the length of
each element or do some searching for the sign in the lower nibble to
discover it.  With the raw data and element size in hand, you'll need to put
each element into a byte array.

    At that point, you can use JTOpen's
com.ibm.as400.access.AS400PackedDecimal class to convert the elements
properly.

    Sounds like fun.

    An alternative may be to use an RPG program, which I assume already
knows how to strip out the data into an array, as a stored procedure to hand
back the data.  That, of course, would mean two trips to the database.


                                                         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: "Jialei Guan" <jguan@xxxxxxxxxxxxxxxxxx>
To: "Java Programming on and around the iSeries / AS400"
<java400-l@xxxxxxxxxxxx>
Sent: Saturday, December 13, 2003 10:39 AM
Subject: How to access packed data type array in Char of DB2/400 in java


> Hi,
> In RPG programming, someone like to put a packed numeric array in a Char
> field of DB2/400.
> How can I get the array from this Char field?
>
> Thanks,
>
>
> Charlie
>



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.