Author |
Message
|
mboldrin |
Posted: Wed Aug 31, 2005 1:02 pm Post subject: MQ and C# |
|
|
Newbie
Joined: 31 Aug 2005 Posts: 3
|
I am new to MQ....
I am using some canned code (C# example from IBM) to put a message to a MQ queue. When I put the message into the queue, it appears in a double byte character format. Is there any way to convert it to single byte. |
|
Back to top |
|
 |
csmith28 |
Posted: Wed Aug 31, 2005 1:11 pm Post subject: |
|
|
 Grand Master
Joined: 15 Jul 2003 Posts: 1196 Location: Arizona
|
Please be more verbose about this issue.
WMQ Version?
Operating System Platform?
What sample script are you using to put the messages?
I am assuming amqsput.
What do you mean by "double byte character format"?
What are you using to browse the message once it reaches the Queue? _________________ Yes, I am an agent of Satan but my duties are largely ceremonial. |
|
Back to top |
|
 |
mboldrin |
Posted: Thu Sep 01, 2005 4:27 am Post subject: |
|
|
Newbie
Joined: 31 Aug 2005 Posts: 3
|
WMQ Version?
Version: 5.3.0
Operating System Platform?
Windows
What sample script are you using to put the messages?
I am assuming amqsput.
basically I have set up a C# webservice in .NET to put messages to a queue
here is the important part.
mqMsg = new MQMessage();
mqMsg.WriteString(message);
mqMsg.Format = MQC.MQFMT_STRING; mqPutMsgOpts = new MQPutMessageOptions(); try
{
mqQueue.Put( mqMsg, mqPutMsgOpts);
}
What do you mean by "double byte character format"?
if I put a message into the queue such as test.
When it is in the queue it looks like "t.e.s.t" So a message of 4 charcter long becomes 8.
What are you using to browse the message once it reaches the Queue?
RFHUTIL and the MQ explorer
Thanks for any help, I have been messing around with changing the mpPurMsgOpts and the format of the message by changing it to MQC.MQFMT_NONE or using a UTF character set. But I have just been plugging in the dark. |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Sep 01, 2005 4:34 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
C# uses Unicode strings as default.
Unicode is a double-byte character standard.
Your code is doing what you are telling it to do.
It is *not* MQ. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
zpat |
Posted: Thu Sep 01, 2005 6:21 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
The important thing is to set the MQMD.CCSID to match the format of the data in the message. Ie set an ASCII CCSID with ASCII data, or a suitable DBCS CCSID with DBCS data.
A well written program will issue MQGET with CONVERT and therefore the actual character set is not critical as long as it matches the character set id in the MQMD.
If you don't code a CCSID you get the QM default which is probably ASCII Windows. |
|
Back to top |
|
 |
mboldrin |
Posted: Thu Sep 01, 2005 12:14 pm Post subject: |
|
|
Newbie
Joined: 31 Aug 2005 Posts: 3
|
Thanks - that is the ticket |
|
Back to top |
|
 |
|