• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ebcdic to ascii

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello all,

I am receiving a message from an as400 to win box so the message is in ebcdic
I have scoured forever for help and stumbles across this little ditty.
I would like to get an array of bytes and use this but
it is confusing to say the least. can some one show me an example of how this would be used?

thanks alot!

 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Perhaps something like:

assuming the above code is in a proper class that has access to your Translate class, something like the above should work. You will then have a string of EBCDIC characters that you can use.

If I have misunderstood what you wanted, or written something stupid, please let me know.

DD
 
Dun Dagda
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Oops, your method returns an int, I forgot to cast it to a byte before putting it in the array like this:


Sorry about that, :roll:
DD
 
Dun Dagda
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anyway, looking more closely at the constructors of the String class in the Java API documentation, String has overloaded constructors that handle byte arrays in a specified charset, so it should be possible to do something like this:

to give you a string translated into EBCDIC, rather than use the Translate class that you found.

DD
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic