Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I convert a String from EBCDIC to ASCII? 1

Status
Not open for further replies.

mixer

Programmer
Jan 11, 2000
14
0
0
US
I have an application that receives a parm in EBCDIC and I need to convert it to ascii. Anyone have an idea how this might be accomplished? Locked into Java 1.3

Thanks.
 
At


there is a free java utility with source to do the conversion. I haven't downloaded or tried it. The classic way to do these kind of conversions is to use an array of 256 bytes or chars, where for every EBCDIC code there is a correspondig ASCII code. So for example the char "1" is in EBCDIC code ="F1" (hex) and in ASCII code = "31" (hex).
At position "F1" (hex) = (15 * 16) + 1 = 241 in the array there will be "31" (hex).

But I think you can also solve this problem yourself with "OutputStreamWriter" where you can specify an encoding. (Although java.nio.charset.Charset is in from jdk1.4 you can still get it to work in without using it, I think)
 
Thanks, I think the utility will work. Appreciate the link.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top