Search code examples
javasqldb2ibm-midrange

IBM i (as400) DB2 retrieve and unpack value from java


I'm trying to retrieve a packed value from db2 (as400). I have no experience with DB2 and completely unaware of PACK values.

Can somebody provide me packing or unpacking algorithm.

I have already tried SELECT HEX(value) FROM...... This is not working...

Thanx in advance.


Solution

  • Problem solved,

    We can decrypt <BLOB> type value using IBM500 Coded character set identifiers, in java.

    //rsAS400.getBytes("F00001") this returns <BLOB> type value
    
    String value = new String(rsAS400.getBytes("F00001"), "IBM500");