Author |
Message
|
pmehta |
Posted: Thu Apr 01, 2004 1:54 am Post subject: Problem is reading the response as ASCII |
|
|
 Novice
Joined: 29 Jul 2003 Posts: 13
|
I am using JMS to put and get the messages. My problem is that the response is coming from the z/os system. The response can be either in binary or in ASCII or in both Binayr as well as ASCII.
I want to always receive the message in ASCII. But I have no idea of how we can handle this with MQ and JMS |
|
Back to top |
|
 |
bower5932 |
Posted: Thu Apr 01, 2004 6:23 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
There are 5 types of messages that can be sent via JMS. You can find information on them in the Using Java manual. If I understand your question, look at using a BytesMessage rather than a TextMessage. |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Apr 01, 2004 6:33 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Are you sure you don't have that backwards? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
bower5932 |
Posted: Thu Apr 01, 2004 6:35 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
I thought he wanted to mix binary and ascii data in the same message. I figured this would be Bytes rather than Text? |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Apr 01, 2004 7:01 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
bower5932 wrote: |
I thought he wanted to mix binary and ascii data in the same message. I figured this would be Bytes rather than Text? |
If he "want to always receive the message in ASCII"? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
bower5932 |
Posted: Thu Apr 01, 2004 7:02 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
Quote: |
or in both Binayr as well as ASCII |
I took this to mean that the message was mixed. |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Apr 01, 2004 7:53 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Well, yes, it does sound like the response will be mixed.
But it also sounds like he wants the mixed stuff converted to ASCII. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
pmehta |
Posted: Fri Apr 02, 2004 1:24 am Post subject: |
|
|
 Novice
Joined: 29 Jul 2003 Posts: 13
|
yes the response which is coming is having a mixed format and i want that mixed stuff to be converted into ASCII.
How can i use the BytesMessage instead of TextMessage?
For TextMessage MQMD format is set as MQSTR. Which MQMD format should be used to get the BytesMessage. |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Apr 02, 2004 5:29 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
If you do want everything to be ASCII string data, then you do need to use a TextMessage, and the MQMD Format should be MQFMT_STRING.
But you really need to be aware of what happens when you treat binary data as ASCII data. It's really probably not what you want to do. One thing that could happen is if your binary data contains a binary 0, then your string data may get truncated. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
bower5932 |
Posted: Fri Apr 02, 2004 6:07 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
If you are going to mix the data in the message (ie, binary and ascii), then MQ won't be able to know anything about it. You'll have to define your own message format (don't start it with MQ, they're reserved) and write a conversion exit to convert the data.
As Jeff said, you need to watch what you are doing. Depending on the data, you might be better off flowing it all as text. You can then treat the message as a string and have MQ convert it. You'd have to convert the strings back to binary yourself. |
|
Back to top |
|
 |
|