Author |
Message
|
angka |
Posted: Thu Nov 16, 2006 5:41 pm Post subject: Setting of CCSID |
|
|
Chevalier
Joined: 20 Sep 2005 Posts: 406
|
Hi all,
What is the best practice for setting the CCSID of a message communicating between 2 MQ server? For example, the sender in Windows platform using .NET will have a default CCSID of 1200 so is it necessary for the Sender to set the message CCSID to 437 before sending out the message? On the receiving end, is it right that the receiver in any platform will have to set their CCSID correspond to their platform before reading the Application Data?
Thanks. |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Nov 16, 2006 5:45 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
The best practice is to ignore the CCSID entirely, and code your applications to specify MQGMO_CONVERT on all their GETS. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
bruce2359 |
Posted: Fri Nov 17, 2006 6:45 am Post subject: |
|
|
Guest
|
By default, the queue manager (on the platform where the program MQPUTs the message) will fill in the CCSID of the message descriptor with the queue managers CCSID.
Optionally (not best practice), the programmer can fill in (hard code) the field with a CCSID; but this makes the program non-portable to another platform. |
|
Back to top |
|
 |
zpat |
Posted: Fri Nov 17, 2006 7:28 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
Sorry that's not correct. No conversion happens by changing the CCSID.
The MQMD.CCSID must correctly DESCRIBE the message data - it does not convert it.
If the default CCSID is not the same as the codepage of the message data you MUST set it to be the correct value. You should only leave it alone if it matches the data.
Providing it matches the data then conversion can occur either on the channel if CONVERT(YES) or by MQGMO_CONVERT.
Also the MQMD.Format must be set to MQFMT_STRING ("MQSTR") |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Nov 17, 2006 7:34 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Actually, the MQMD.Format must be set to a known format for MQ to perform the conversion.
That is, MQ must be able to find a conversion routine for the format.
It's just that most of us send TEXT data, and so using MQFMT_STRING invokes the default TEXT conversion routine, which is what we want. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
angka |
Posted: Tue Nov 21, 2006 1:18 am Post subject: |
|
|
Chevalier
Joined: 20 Sep 2005 Posts: 406
|
Hi all,
zpat: I using .NET and below are my codes which converts the application data to the MQMD.CCSID that i set.
string message ="hello";
queueMessage.CharacterSet = 819;
queueMessage.WriteString(message);
so it is the WriteString function and not MQ tt converts it. Thanks all |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Nov 21, 2006 2:30 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
But now you've coded your sender to do something specific for the platform that your reciever is on, and that's not a good idea. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
JasonE |
Posted: Tue Nov 21, 2006 3:16 am Post subject: |
|
|
Grand Master
Joined: 03 Nov 2003 Posts: 1220 Location: Hursley
|
.net and java convert between unicode and the codepage in the message ccsid during the read or writestring operations - in these languages you generally dont use get with convert. This is because those languages work internally in unicode and provide data conversion routines, plus you access the message through getters/setters so it can occur.
C, COBOL, PLI, C++ etc just get the message contents, and for those you would generally use get with convert so the data is converted to the ccsid ready for direct binary access to the data. |
|
Back to top |
|
 |
angka |
Posted: Tue Nov 21, 2006 6:57 pm Post subject: |
|
|
Chevalier
Joined: 20 Sep 2005 Posts: 406
|
Hi all,
jefflowrey: I didnt code it that way.. just testing out. Thanks..
I will follow the best practice. thanks all. =) |
|
Back to top |
|
 |
|