Author |
Message
|
hhoang |
Posted: Fri Mar 03, 2006 8:44 am Post subject: MQ added Additional White Spaces |
|
|
Novice
Joined: 14 Nov 2002 Posts: 21
|
We are using .NET library of the IBM WebSphere MQ Client, Version 5.3 to send messages to the MQ on the mainframe (IMS). We are sending over 10,000 messages and most having no problems but only a few messages got additional white spaces added at the end. The only pattern we can see is that these messages are longer (296 characters) then the typical messages. Do you have any ideas?
Code: |
protected void SendMQMessage(string messageText, string queueName,
string queueMgrName, string channelName, int port, string mqServerName)
{
MQQueueManager queueManager = null;
MQQueue queue = null;
try
{
MQEnvironment.Channel = channelName;
MQEnvironment.Port = port;
MQEnvironment.Hostname = mqServerName;
queueManager = new MQQueueManager(queueMgrName);
MQMessage message = new MQMessage();
MQPutMessageOptions pmo = new MQPutMessageOptions();
pmo.Options = MQC.MQPMO_NONE;
message.Format = MQC.MQFMT_STRING;
message.WriteString(messageText);
queue = queueManager.AccessQueue(queueName, MQC.MQOO_OUTPUT);
queue.Put(message, pmo);
}
catch(Exception ex)
{
Log.Error("MQQueueManager::Put failed", ex);
throw ex;
}
finally
{
if (queueManager != null)
{
queueManager.Disconnect();
queueManager = null;
}
}
} |
|
|
Back to top |
|
 |
EddieA |
Posted: Fri Mar 03, 2006 9:23 am Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Quote: |
a few messages got additional white spaces added at the end. |
MQ won't do this.
Where are you seeing the additional data. I'd take a look at the application that "thinks" there is.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
hhoang |
Posted: Fri Mar 03, 2006 10:49 am Post subject: |
|
|
Novice
Joined: 14 Nov 2002 Posts: 21
|
EddieA wrote: |
Where are you seeing the additional data. I'd take a look at the application that "thinks" there is.
|
I used the message browser and I see the data length is not what I expected. I tested using MQ on Windows and I also see this. |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Mar 03, 2006 11:07 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Which message browser?
amqsbcg?
How are you sure that the extra characters are not in the "messageText" variable that you are writing to the message? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
hhoang |
Posted: Fri Mar 03, 2006 11:13 am Post subject: |
|
|
Novice
Joined: 14 Nov 2002 Posts: 21
|
Originally, I thought this is a mainframe issue, so I decided to try and send a message to another windows box and I get the same problem.
I check the message length (295) before I send and I see the data length on the queue to be 590, which is double the actual message. I also tried to send the message like "abc" and the datalength is 6.
If you are on windows, then you click on the queue name then you can browse the message and that is what I mean message browser. |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Mar 03, 2006 11:14 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
OH.
So you mean you're sending Unicode text, and expecting it to be ASCII. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
hhoang |
Posted: Fri Mar 03, 2006 11:16 am Post subject: |
|
|
Novice
Joined: 14 Nov 2002 Posts: 21
|
I am just sending regular text. I didn't specified any encoding. Please take a look at the code on the first post. |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Mar 03, 2006 11:17 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
hhoang wrote: |
I am just sending regular text. I didn't specified any encoding. Please take a look at the code on the first post. |
You are sending Unicode.
You are then looking at it as if it was ASCII, and being surprised that you are seeing double byte characters. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
hhoang |
Posted: Fri Mar 03, 2006 11:33 am Post subject: |
|
|
Novice
Joined: 14 Nov 2002 Posts: 21
|
You are right I see the character set id is 1200, which unicode.
I need to set it to 437 instead and it fixes the problem.
Thank you for your help |
|
Back to top |
|
 |
|