Reputation: 1827
I had found this useful link for unpacked COMP-3 digit, but i need to unpack COMP digit this time, is anyone know how to unpack it? Thanks a lot!
Upvotes: 4
Views: 500
Reputation: 3761
IBM Provides a library of Java methods to simplify interactions with z/OS services and data formats. An overview can be found here jZOS Toolkit
Here is a link to PackedDecimal Operations
Here are others for managing binary data ByteArrayUnmarshaller
Upvotes: 1
Reputation: 10543
In most Cobol compilers Comp is a big endian binary integer. For the mainframe only 2/4/8 bytes are supported. So For signed values
03 Signed-Num pic s9(4) comp.
if you have the value in an array of bytes you can do
BigInteger value = new BigInteger(byteArray);
Alternatively you could use the readShort(), readInt() and readLong() methods of DataInputStream
Finally JRecord will let you read Cobol files with a Cobol copybook
Upvotes: 1