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 » General IBM MQ Support » MQ added Additional White Spaces

Post new topic  Reply to topic
 MQ added Additional White Spaces « View previous topic :: View next topic » 
Author Message
hhoang
PostPosted: Fri Mar 03, 2006 8:44 am    Post subject: MQ added Additional White Spaces Reply with quote

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
View user's profile Send private message
EddieA
PostPosted: Fri Mar 03, 2006 9:23 am    Post subject: Reply with quote

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
View user's profile Send private message
hhoang
PostPosted: Fri Mar 03, 2006 10:49 am    Post subject: Reply with quote

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
View user's profile Send private message
jefflowrey
PostPosted: Fri Mar 03, 2006 11:07 am    Post subject: Reply with quote

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
View user's profile Send private message
hhoang
PostPosted: Fri Mar 03, 2006 11:13 am    Post subject: Reply with quote

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
View user's profile Send private message
jefflowrey
PostPosted: Fri Mar 03, 2006 11:14 am    Post subject: Reply with quote

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
View user's profile Send private message
hhoang
PostPosted: Fri Mar 03, 2006 11:16 am    Post subject: Reply with quote

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
View user's profile Send private message
jefflowrey
PostPosted: Fri Mar 03, 2006 11:17 am    Post subject: Reply with quote

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
View user's profile Send private message
hhoang
PostPosted: Fri Mar 03, 2006 11:33 am    Post subject: Reply with quote

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

MQSeries.net Forum Index » General IBM MQ Support » MQ added Additional White Spaces
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.