Author |
Message
|
alperb |
Posted: Wed Mar 16, 2005 10:52 am Post subject: unsigned char for useEmptyBuffer & useFullBuffer |
|
|
Apprentice
Joined: 01 Jun 2004 Posts: 25
|
being a newbie I have some questions
I am trying to put and get some message however message is type of byte.
I got some examples but they all use string format and the useemptybuffer takes const char as first parameter.
how can I put and get byte to MQ?
Also when talking to a mainframe do I have to explicitly do conversion ASCII-EBCDIC or is there a better way of doing so?
thanks is advance
 |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Mar 16, 2005 1:10 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Quote: |
Also when talking to a mainframe do I have to explicitly do conversion ASCII-EBCDIC or is there a better way of doing so? |
There is a better way for doing so providing the totality of your message payload is text.
Set MQMD format to MQSTR (see constants / programmer manual)
When retrieving the message use the getoption WithConvert ...
Sorry if the terms are not exact... looks like my memory is shot today.
Enjoy  |
|
Back to top |
|
 |
bower5932 |
Posted: Wed Mar 16, 2005 1:12 pm Post subject: Re: unsigned char for useEmptyBuffer & useFullBuffer |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
alperb wrote: |
Also when talking to a mainframe do I have to explicitly do conversion ASCII-EBCDIC or is there a better way of doing so? |
If the format of your message is MQSTR, then the WMQ can do the conversion for you. |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Mar 16, 2005 1:17 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
First you want to put raw bytes to the message, not characters.
Then you want those bytes to be treated as characters, and converted from one character set to another.
I'm confused. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
alperb |
Posted: Thu Mar 17, 2005 12:37 am Post subject: bytes not chars |
|
|
Apprentice
Joined: 01 Jun 2004 Posts: 25
|
In fact I am trying to to put raw bytes to the message not characters what MQSTR doesn't do. |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Mar 17, 2005 4:26 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Then you will have to write your own conversion in a message exit on the channel.
Have fun as there is no way to know what format the different message types passing through the channel will have and you need to handle them all.
Create a new copy book with all fields as text especially numbers and use MQSTR. Conversion is automatic you'll be much better off.
Enjoy  |
|
Back to top |
|
 |
alperb |
Posted: Thu Mar 17, 2005 5:13 am Post subject: |
|
|
Apprentice
Joined: 01 Jun 2004 Posts: 25
|
thanks.
then what is the format for raw bytes while putting and getting from queue? |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Mar 17, 2005 5:22 am Post subject: Re: bytes not chars |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
alperb wrote: |
In fact I am trying to to put raw bytes to the message not characters what MQSTR doesn't do. |
Then you don't care if the raw bytes get converted to EBCDIC, and in fact that would probably be bad - as they would now be different bytes.
What language are you using, anyway? C? C++?
Are you aware that C treats char and byte as the same thing? So an array of chars is the same as an array of bytes, unless you pass it to functions that treat that array as String data (like strcpy)... _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
bower5932 |
Posted: Thu Mar 17, 2005 7:56 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
fjb_saper wrote: |
Then you will have to write your own conversion in a message exit on the channel. |
Couldn't you use your own user-defined message format for each type of message? You could then have a data-conversion exit called during the MQGET to convert the data. There are details in the Application Programming Guide.
However, I'm still a big believer that you need to consider sending nothing but text data and use MQSTR as your format. |
|
Back to top |
|
 |
alperb |
Posted: Thu Mar 17, 2005 2:12 pm Post subject: |
|
|
Apprentice
Joined: 01 Jun 2004 Posts: 25
|
In fact I am using use c++. What makes me curious is if MQSTR is OK with bytes (unsigned char) then why examples use the useemptybuffer which takes const char as first parameter? |
|
Back to top |
|
 |
|