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 » IBM MQ API Support » Trouble with CCSID

Post new topic  Reply to topic
 Trouble with CCSID « View previous topic :: View next topic » 
Author Message
cawitt
PostPosted: Fri Apr 14, 2006 1:42 pm    Post subject: Trouble with CCSID Reply with quote

Newbie

Joined: 14 Apr 2006
Posts: 2

I'm maintaining a .NET application which sends messages to a queue. The original code looked like this:
Code:
            MQQueueManager queManager = new MQQueueManager( queManagerName, channel, hostPort );

            // -- configure message object
            mqMsg = new MQMessage();
            mqMsg.MessageType = MQC.MQMT_DATAGRAM;
            mqMsg.Format = MQC.MQFMT_STRING;
            mqMsg.CharacterSet = 500; 
            mqMsg.WriteString( message );

            // -- send message
            queManager.Put( queue, mqMsg );   
            queManager.Commit();
            queManager.Disconnect();

As you can see, the CharacterSet is hard-coded to 500. This was working somewhat ok, but it turns out that special characters weren't being converted correctly. I was informed that this queue does not use CCSID=500, but 37. I changed it to 37 and it seemed to work better. However, we have four platforms: devel, sat, qax, and prod, and I've been informed that they may all use different CCSID's, and if any of them change, I'd like the app to be able to work without special coding for each instance.

Originally I tried not setting the CharacterSet property, but that didn't work. The documentation says that it defaults to 1200 (Unicode), which I guess is wrong. So then I tried this code:
Code:
            MQQueueManager queManager = new MQQueueManager( queManagerName, channel, hostPort );

            // -- inquire on the QueueManager (to find CCSID)
            int[] selectors = new int[1];
            int[] intAttrs = new int[1];
            byte[] charAttrs = new byte[0];
            selectors[0] = MQC.MQIA_CODED_CHAR_SET_ID;
            queManager.Inquire(selectors,intAttrs,charAttrs); // currently setting intAttrs[0]=437 on all platforms

            // -- configure message object
            mqMsg = new MQMessage();
            mqMsg.MessageType = MQC.MQMT_DATAGRAM;
            mqMsg.Format = MQC.MQFMT_STRING;
            mqMsg.CharacterSet = intAttrs[0]; 
            mqMsg.WriteString( message );

            // -- send message
            queManager.Put( queue, mqMsg );   
            queManager.Commit();
            queManager.Disconnect();

but then what I ended up with, was that it would return 437 as the CharacterSet for all platforms, and it wouldn't work; when I sent a message using that value, it didn't recognize it.

Then we figured that maybe 437 is the CCSID of the local MQQueueManager object, not that on the mainframe. But if that's the case, how do we synchronize the attribute value with that on the mainframe?

If that's not the case, what am I doing wrong?

Oh yeah, we're using MQ Client version 5.3 fix pack level 9, but could upgrade to 6 if we need to.

Thanks in advance for any help!

Chris
Back to top
View user's profile Send private message
wschutz
PostPosted: Fri Apr 14, 2006 1:54 pm    Post subject: Reply with quote

Jedi Knight

Joined: 02 Jun 2005
Posts: 3316
Location: IBM (retired)

Okay, starting at the beginning... you are running the MQ client on a windows platform. Is this client connecting directly to the zOS qmgr or some other qmgr?

Normally, you shouldn't need to pt so much effort into setting the CCSID, as MQ will take care of it. 437 is normal for a windows machine (or perhaps 850).

500 is an ebcdic codepage...I'm surprised that works....
_________________
-wayne
Back to top
View user's profile Send private message Send e-mail AIM Address
zpat
PostPosted: Fri Apr 14, 2006 11:55 pm    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

At the risk of stating the obvious, you do realise that data conversion takes place on the MQGET (with MQGMO_CONVERT) and not on the MQPUT?

The CCSID when you put to the queue has to accurately describe the data in the message. It does not convert it to that CCSID.

Since conversion is on the MQGET, the same message format/CCSID can be processed by any application on any platform.

In my experience .NET applications generate data as CCSID 1200 and this will be set by default if you don't override it.

Check out the MQ and .NET manual.
Back to top
View user's profile Send private message
cawitt
PostPosted: Mon Apr 17, 2006 7:25 am    Post subject: Reply with quote

Newbie

Joined: 14 Apr 2006
Posts: 2

According to our middleware guy, the MQ Client application on Windows connects directly via a SVRCONN channel to a zOS Qmgr.

zpat: I am not trying to do a conversion myself. In my post above, I stated: "Originally I tried not setting the CharacterSet property, but that didn't work. The documentation says that it defaults to 1200 (Unicode), which I guess is wrong [meaning, the wrong code, since the message doesn't get read properly]."

I have tried not setting CharacterSet, and that didn't work (the message CharSet is 1200 in that case, which is the default). It also didn't work when I set it to 437. It works if I hard-code it to 500 or 37, but I'd like to always make sure I'm setting it to the proper thing.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Apr 17, 2006 7:27 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

The application that is reading this queue needs to set MQGMO_CONVERT on it's GET.

Then your application, which is PUTTING to this queue, can ignore the CCSID entirely.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Apr 17, 2006 4:26 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

jefflowrey wrote:
The application that is reading this queue needs to set MQGMO_CONVERT on it's GET.

Then your application, which is PUTTING to this queue, can ignore the CCSID entirely.
Provided that it sets correctly the format to MQSTR.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » Trouble with CCSID
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.