Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cp1047 Charecter Encoding to read JDBC string EBCDIC data.

 
Siva Vu
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Retrieving string from DB2 (Z/OS) (JDBC)
that does contain packed decimal value.

When I am trying to get bytes using String.getBytes("Cp1047"),
I am getting correct bytes for all
Excpet for 15 and 25.
Rather it is resulting in swapped values for these,
i.e, it is getting 25 for 15 and vice versa.

What could be the wrong?
Or should I read bytes directly from ResultSet
using ResultSet.getBinaryStream("COLUMN") ?

Or do 15 and 25 have some special meaning on the
Java Platform.
Thanks in advance.
 
Scott Selikoff
author
Saloon Keeper
Posts: 4010
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you need data with decimals have you tried getDouble()?
 
Herman Schelti
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Siva,

I had the same problem a few years ago on the z/OS platform.

The Java program did convert it's input to x'15' and after a update of DB2's drivers, it became x'25', and later on it became x'15' again.

We 'solved' this problem outside of the Java-code : the receiving Cobol-program was changed, so that it would accept both x'15' and x'25'.

Herman
 
Siva Vu
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not calling any COBOL programs. I am just retieving rwos with just simple SELECT statement and trying to read the column data that is coming as String.
 
Arnab Jena
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Did anyone find any solution for the issue of 25 and 15?
For me the value 25 gets converted to 15 in only come cases and not all.

Best Regards,
Arnab Jena
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic