Author |
Message
|
jejo |
Posted: Tue Feb 08, 2011 9:58 pm Post subject: MQ setting CCSID and Encoding |
|
|
Newbie
Joined: 30 Jan 2011 Posts: 9
|
Hi everyone!
My Requirement says that message needs CCSID and encoding to be set in Properties and MQMD.
I'm using clientconnection with mQ and sending message to the Queue with setting CCSID =500 and encoding as 273, This setting I did in MQMessage level.
I'm able to send the message to MQ, but the client who is using that message says that the message is not in proper format in which he is expected..
I've set it in MQMessage, Is this enough or I need to add something MQenvironment.
Since I'm new to MQ I'm not sure where I'm missing... |
|
Back to top |
|
 |
Mr Butcher |
Posted: Tue Feb 08, 2011 11:28 pm Post subject: |
|
|
 Padawan
Joined: 23 May 2005 Posts: 1716
|
if the ccsid and encoding you are setting are right and match the message content then the consumer of the message should be fine ... ?!?
maybe the consumer should use get-convert? what is he expecting that he does not find? _________________ Regards, Butcher |
|
Back to top |
|
 |
jejo |
Posted: Wed Feb 09, 2011 12:46 am Post subject: |
|
|
Newbie
Joined: 30 Jan 2011 Posts: 9
|
What's happening here is , Earlier there used to be a message broker between the queue and our end, which did the operation of applying CCSID and encoding to the message which is understood by the Consumer.
Now what we are trying to do is Bypass the message broker and instead setting ccsid and encoding from our Java code itself..
hope u understand the scenario.. |
|
Back to top |
|
 |
fatherjack |
Posted: Wed Feb 09, 2011 2:04 am Post subject: |
|
|
 Knight
Joined: 14 Apr 2010 Posts: 522 Location: Craggy Island
|
And your Java client is connecting to a mainframe QMGR? _________________ Never let the facts get in the way of a good theory. |
|
Back to top |
|
 |
jejo |
Posted: Wed Feb 09, 2011 2:23 am Post subject: |
|
|
Newbie
Joined: 30 Jan 2011 Posts: 9
|
|
Back to top |
|
 |
fatherjack |
Posted: Wed Feb 09, 2011 2:29 am Post subject: |
|
|
 Knight
Joined: 14 Apr 2010 Posts: 522 Location: Craggy Island
|
As Mr Butcher asked, is the consumer doing a MQGET with CONVERT? Is the format set to MQSTR? _________________ Never let the facts get in the way of a good theory. |
|
Back to top |
|
 |
jejo |
Posted: Wed Feb 09, 2011 2:45 am Post subject: |
|
|
Newbie
Joined: 30 Jan 2011 Posts: 9
|
Actually the consumer is mapping the message directly to a table and We don't know exactly what's happening at the consumer since it's a 3rd party level.
As i said in my previous post, when the message is sent through MessageBroker(Where Conversion happens) the consumer able to get the message properly from the queue. the properly arises only when we set encoding and ccsid at the JAVa code and bypass the message broker.
The following is the code which we are using,
Code: |
putMsgOptions=new MQPutMessageOptions();
putMsgOptions.options = putMsgOptions.options + MQC.MQMO_MATCH_CORREL_ID+MQC.MQPMO_SYNCPOINT+MQC.MQGMO_CONVERT;;
msg.characterSet = ccsidInt;
msg.encoding = encodingInt;
msg.format = MQC.MQFMT_STRING;
msg.messageType = MQC.MQMT_REQUEST;
msg.writeString(buffer.toString());
sendQueue.put(msg,putMsgOptions);
queueManager.commit();
sendQueue.close(); |
|
|
Back to top |
|
 |
mqjeff |
Posted: Wed Feb 09, 2011 4:17 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Is the buffer that you are toString-ing and writeString-ing actually *in* the CCSID you are setting? |
|
Back to top |
|
 |
fatherjack |
Posted: Wed Feb 09, 2011 4:42 am Post subject: |
|
|
 Knight
Joined: 14 Apr 2010 Posts: 522 Location: Craggy Island
|
jejo wrote: |
Code: |
putMsgOptions=new MQPutMessageOptions();
putMsgOptions.options = putMsgOptions.options + MQC.MQMO_MATCH_CORREL_ID+MQC.MQPMO_SYNCPOINT+MQC.MQGMO_CONVERT; |
|
Is that really what you want? Adding get message options to put message options? _________________ Never let the facts get in the way of a good theory. |
|
Back to top |
|
 |
jejo |
Posted: Wed Feb 09, 2011 4:45 am Post subject: |
|
|
Newbie
Joined: 30 Jan 2011 Posts: 9
|
Converting from StringBuffer to String and WritingString with CCSID
Sorry My Actual code for putMessageOptions is the following..
Code: |
putMsgOptions = new MQPutMessageOptions(); // Set Put Options
int newReqMsgId = MQC.MQMO_MATCH_CORREL_ID;
putMsgOptions.options = putMsgOptions.options + newReqMsgId;
putMsgOptions.options = putMsgOptions.options + MQC.MQPMO_SYNCPOINT;
putMsgOptions.options = putMsgOptions.options + MQC.MQGMO_CONVERT; |
|
|
Back to top |
|
 |
jejo |
Posted: Wed Feb 09, 2011 5:03 am Post subject: |
|
|
Newbie
Joined: 30 Jan 2011 Posts: 9
|
Am I following correct method in the putMessageOptions? |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Feb 09, 2011 5:54 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
jejo wrote: |
Converting from StringBuffer to String and WritingString with CCSID |
Are the characters in the StringBuffer actually in the same CCSID that you are applying to the message properties?
If you have constructed a Unicode string buffer and are telling MQ that it is an EBCDIC string, you will have problems trying to read it. |
|
Back to top |
|
 |
fatherjack |
Posted: Wed Feb 09, 2011 8:06 am Post subject: |
|
|
 Knight
Joined: 14 Apr 2010 Posts: 522 Location: Craggy Island
|
jejo wrote: |
Am I following correct method in the putMessageOptions? |
I'm no java guru so won't comment on the 'method'. But you appear to be adding options to the putMessageOptions that are not appropriate. E.g. MQGMO_CONVERT is a getMessageOption. Now I'm sure the hex value of that constant has some meaning to putMessageOptions but it is unlikely to be what you expect. Therefore you may well experience behaviour that you were not anticipating.
Having said that, I suspect this particular problem is more likely to be as a result of what mqjeff is suggesting. _________________ Never let the facts get in the way of a good theory. |
|
Back to top |
|
 |
rekarm01 |
Posted: Sat Feb 12, 2011 12:30 pm Post subject: Re: MQ setting CCSID and Encoding |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
jejo wrote: |
My Requirement says that message needs CCSID and encoding to be set in Properties and MQMD. |
'Properties' headers exist within a WMB message tree, but not within a WMQ message.
jejo wrote: |
I'm able to send the message to MQ, but the client who is using that message says that the message is not in proper format in which he is expected. |
That's not enough information to go on. Describe in more detail the difference between the actual and expected message. Browsing utilities, such as sample program amqsbcg0, support pack IH03 - (rfhutil), or support pack MO71 - (WMQ GUI Admin tool), are useful for inspecting the message headers and data for character conversion problems.
jejo wrote: |
Am I following correct method in the putMessageOptions? |
No. Neither MQMO_MATCH_CORREL_ID nor MQGMO_CONVERT are appropriate put message options. |
|
Back to top |
|
 |
fjb_saper |
Posted: Sat Feb 12, 2011 3:38 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Also if you need to transform the CCSID on put for a message of MQFMT_STRING format, Java base requires more coding than JMS.
- In JMS, just set the desired CCSID on the destination and send the TextMessage as you would normally do.
- In Java base you need to make sure that the bitstream you write to the message is in the proper CCSID and then set the CCSID on the message before putting it.
Note: The assumption here is that the qmgr would know how to transform a text message from one CCSID into the other. If not you will have to look into the conversion tables and maybe build your own.
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|