|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Trouble with CCSID |
« View previous topic :: View next topic » |
Author |
Message
|
cawitt |
Posted: Fri Apr 14, 2006 1:42 pm Post subject: Trouble with CCSID |
|
|
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 |
|
 |
wschutz |
Posted: Fri Apr 14, 2006 1:54 pm Post subject: |
|
|
 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 |
|
 |
zpat |
Posted: Fri Apr 14, 2006 11:55 pm Post subject: |
|
|
 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 |
|
 |
cawitt |
Posted: Mon Apr 17, 2006 7:25 am Post subject: |
|
|
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 |
|
 |
jefflowrey |
Posted: Mon Apr 17, 2006 7:27 am Post subject: |
|
|
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 |
|
 |
fjb_saper |
Posted: Mon Apr 17, 2006 4:26 pm Post subject: |
|
|
 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 |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|