ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » ebcdic to ascii

Post new topic  Reply to topic
 ebcdic to ascii « View previous topic :: View next topic » 
Author Message
gavon stone
PostPosted: Fri Apr 22, 2005 12:07 pm    Post subject: ebcdic to ascii Reply with quote

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
View user's profile Send private message
jefflowrey
PostPosted: Fri Apr 22, 2005 12:58 pm    Post subject: Reply with quote

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
View user's profile Send private message
gavon stone
PostPosted: Fri Apr 22, 2005 1:00 pm    Post subject: ebcdic to ascii Reply with quote

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
View user's profile Send private message
jefflowrey
PostPosted: Fri Apr 22, 2005 1:05 pm    Post subject: Re: ebcdic to ascii Reply with quote

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
View user's profile Send private message
gavon stone
PostPosted: Fri Apr 22, 2005 1:10 pm    Post subject: ebcdic to ascii Reply with quote

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
View user's profile Send private message
jefflowrey
PostPosted: Fri Apr 22, 2005 3:22 pm    Post subject: Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Fri Apr 22, 2005 3:35 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » ebcdic to ascii
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.