Author |
Message
|
gavon stone |
Posted: Fri Apr 22, 2005 12:07 pm Post subject: ebcdic to ascii |
|
|
Novice
Joined: 09 Mar 2005 Posts: 16
|
I need to convert a message originally in ebcdic into ascii I would like to know 1) which sytem does the conversion(sender or receiver) and how do I go about doing that.
thanks |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Apr 22, 2005 12:58 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Are you using Java, or JMS?
In either case, the receiver should always be responsible for the conversion. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
gavon stone |
Posted: Fri Apr 22, 2005 1:00 pm Post subject: ebcdic to ascii |
|
|
Novice
Joined: 09 Mar 2005 Posts: 16
|
I am using JMS. How do you go about doing the conversion in jms on the receiver side.
thanks |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Apr 22, 2005 1:05 pm Post subject: Re: ebcdic to ascii |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
gavon stone wrote: |
I am using JMS. How do you go about doing the conversion in jms on the receiver side. |
You don't.
JMS handles it for you.
Assuming that the sender a) is only sending text data, b) has properly indicated that the format of the message is MQFMT_STRING, then you can cast your message object to a TextMessage, and JMS will do the ebcdic to Unicode conversion for you when you read the message data. (Java strings are Unicode by default, not ASCII). _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
gavon stone |
Posted: Fri Apr 22, 2005 1:10 pm Post subject: ebcdic to ascii |
|
|
Novice
Joined: 09 Mar 2005 Posts: 16
|
I already have lots of classes that read or expecting a bytes message and not a text message. Is there a simple way for me to make the conversion without switching to a textMessage.
thanks |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Apr 22, 2005 3:22 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Yeah...
only cast the BytesMessage to a TextMessage when you need the text, rather than a byte array... _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Apr 22, 2005 3:35 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
jefflowrey wrote: |
Yeah...
only cast the BytesMessage to a TextMessage when you need the text, rather than a byte array... |
Only you will get a cast exception. In order to be able to cast to text you need to have the MQSTR as format on the message.
You can cast a TextMessage to a BytesMessage but the reverse is only possible if you truely have a TextMessage...
Depending on your java version (from 1.4 on) check out your io classes. There is the possibility to do some conversion there.
Otherwise you will need to do the conversion through a program.
Easiest way is force your sender to send a text only message and set the format to MQSTR.
Enjoy |
|
Back to top |
|
 |
|