Author |
Message
|
fjb_saper |
Posted: Tue Oct 18, 2011 8:48 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
giridhararm wrote: |
hi here is the encoding is private int _encoding = 1208;
if (_native)
mqMsg.Encoding = MQC.MQENC_NATIVE;
mqMsg.Format = MQC.MQFMT_STRING;
mqMsg.CharacterSet = _encoding;
any idea do i need to post more |
OK once more let's be absolutely clear.
MQ encoding and XML encoding are 2 completely different things.
MQ encoding drives the way numeric binary data is displayed (low order byte first / last)
XML encoding determines the Character set of the data and translates into the MQ CCSID.
The message format MQC.MQFMT_STRING is only valid if ALL of the message content is characters.
You are setting the data to UTF-8 (ccsid 1208). Have you checked that the data is really UTF-8 or does it also contain a byte order mark (first 2 bytes)?
Read the posts by rekarm01 (from memory) about CCSID and byte order...
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
giridhararm |
Posted: Tue Oct 18, 2011 9:09 pm Post subject: |
|
|
Apprentice
Joined: 22 Apr 2009 Posts: 28
|
600MBISMYKL AABN FRX0043 59030000.00 20120817 Y/222323 RBS NV, NEW YORK 00010 MBISMYMBISMYKL ForwardDeals-65927 0.00 0.0
this is the message |
|
Back to top |
|
 |
zpat |
Posted: Tue Oct 18, 2011 10:21 pm Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
giridhararm wrote: |
hi here is the ecoding is private int _encoding = 1208;
if (_native)
mqMsg.Encoding = MQC.MQENC_NATIVE;
mqMsg.Format = MQC.MQFMT_STRING;
mqMsg.CharacterSet = _encoding;
any idea do i need to post more |
Yes, look at the message on a queue and tell me what the MQMD.CCSID is! |
|
Back to top |
|
 |
rekarm01 |
Posted: Wed Oct 19, 2011 12:42 am Post subject: Re: MQSTR |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
The problem description is a bit unclear. It might be helpful to describe the components involved, the expected behavior of each component, the actual behavior of each component, any relevant code, and any error messages.
It appears there is a .NET application that takes some data, writes it to a message, and puts the message on a queue. And then there's a third party tool, that's getting the message off the queue, and encountering some unexpected, and as yet to be identified characters. Is that correct?
giridhararm wrote: |
Code: |
private int _encoding = 1208;
if (_native)
mqMsg.Encoding = MQC.MQENC_NATIVE;
mqMsg.Format = MQC.MQFMT_STRING;
mqMsg.CharacterSet = _encoding; |
any idea do i need to post more? |
Yes. So far, this is just setting the message header. Post the code that writes the data into the message, and the code that puts the message on a queue.
The purpose of the message header properties (CharacterSet, Encoding, Format) is to describe the message data. The sender needs to provide information about how it wrote the data, so that the receiver knows how to read it.
To test that the sending application is working as expected, disable the receving application, put a message on the queue. Examine the message on the queue using a tool that can display the message headers and data (hex display is useful). IBM provides several support pacs for this, such as IH03 (rfhutil) or MO71 (GUI admin), and sample program amqsbcg0. Confirm that the message header accurately describes the message data, and that the message data conforms to any other requirements the receiver may have.
If there is nothing wrong with the message, then any problems must be in the receiving application. |
|
Back to top |
|
 |
giridhararm |
Posted: Wed Oct 19, 2011 2:21 am Post subject: |
|
|
Apprentice
Joined: 22 Apr 2009 Posts: 28
|
private string sendMessage (string pQName, string pMessage, string pCID, string pReplyToQ, string pReplyToQueueManager)
{
if (_mqQMgr != null)
{
_mqQueue = _mqQMgr.AccessQueue( pQName, MQC.MQOO_OUTPUT + MQC.MQOO_FAIL_IF_QUIESCING );
MQMessage mqMsg = new MQMessage();
//set reply to queue name
mqMsg.ReplyToQueueName = pReplyToQ;
mqMsg.ReplyToQueueManagerName = pReplyToQueueManager;
if (pCID.Length > 0)
{
pCID = System.Xml.XmlConvert.DecodeName(pCID.Trim());
mqMsg.CorrelationId = Encoding.UTF8.GetBytes(pCID);
}
mqMsg.Format = MQC.MQFMT_STRING;
mqMsg.CharacterSet = _encoding;
if (_native)
mqMsg.Encoding = MQC.MQENC_NATIVE;
mqMsg.WriteString( pMessage );
MQPutMessageOptions mqPutMsgOpts = new MQPutMessageOptions();
_mqQueue.Put( mqMsg, mqPutMsgOpts );
_mqQueue.Close();
_mqQMgr.Disconnect();
} |
|
Back to top |
|
 |
giridhararm |
Posted: Wed Oct 19, 2011 2:23 am Post subject: |
|
|
Apprentice
Joined: 22 Apr 2009 Posts: 28
|
this is the code we are putting
but we are not using for getting
i iwl lget the ccsid later |
|
Back to top |
|
 |
giridhararm |
Posted: Wed Oct 19, 2011 2:24 am Post subject: |
|
|
Apprentice
Joined: 22 Apr 2009 Posts: 28
|
the data is completly junk |
|
Back to top |
|
 |
zpat |
Posted: Wed Oct 19, 2011 3:38 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
Clarify "junk"?
What tool are you using to view the message?
Quite often "junk" means that the MQMD CCSID and the actual code page of the message data are not aligned.
So that conversion cannot take place and your viewer sees "junk" or unconverted data. |
|
Back to top |
|
 |
giridhararm |
Posted: Thu Oct 20, 2011 7:30 pm Post subject: |
|
|
Apprentice
Joined: 22 Apr 2009 Posts: 28
|
. . . . . . . . . . . . . . . . . . . . . . . . . . .
BROWSE QU QUEUE-TRM.MQD2.FTP.IN.02 ----------------- Line 00000000 Col 321 400
COMMAND ===> SCROLL ===> PAGE
----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0
********************************* Top of Data **********************************
===>ÈÁËÈ.....È?.Ë`ÍÇ/À/......
===>ÈÁËÈ.....È?.êá+è ë.......ø/ËÁ.ÄÇÁÄ,
===>ÈÁËÈÑ>Å.ÃÊ?_.èê(ë.......È?.êá+è ë
===>èáëè._ÁËË/ÅÁ.ÃÊ?_.èê(ë.È?.êá+è ë..,Ñ>À%`.ÊÁËø?>ËÁ.ÑÃ.`?Í.ÊÁÄÑÁÎÁ.ÈÇÑË.È?
===>èáëè._ÁËË/ÅÁ.ÃÊ?_.èê(ë.È?.êá+è ë..,Ñ>À%`.ÊÁËø?>ËÁ.ÑÃ.`?Í.ÊÁÄÑÁÎÁ.ÈÇÑË.È?
===>ÈÁËÈ._ÁËË/ÅÁ.................
===>ÈÁËÈ._Á/ËË/ÅÁ............ÃÊ?_.ã/Ñ:/%.èê(ë
===>...(âñë(ß.<......... â+.............ãêì................................
******************************** Bottom of Data ********************************
this is the junk data am host receiving |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Oct 20, 2011 8:51 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
giridhararm wrote: |
. . . . . . . . . . . . . . . . . . . . . . . . . . .
BROWSE QU QUEUE-TRM.MQD2.FTP.IN.02 ----------------- Line 00000000 Col 321 400
COMMAND ===> SCROLL ===> PAGE
----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0
********************************* Top of Data **********************************
===>ÈÁËÈ.....È?.Ë`ÍÇ/À/......
===>ÈÁËÈ.....È?.êá+è ë.......ø/ËÁ.ÄÇÁÄ,
===>ÈÁËÈÑ>Å.ÃÊ?_.èê(ë.......È?.êá+è ë
===>èáëè._ÁËË/ÅÁ.ÃÊ?_.èê(ë.È?.êá+è ë..,Ñ>À%`.ÊÁËø?>ËÁ.ÑÃ.`?Í.ÊÁÄÑÁÎÁ.ÈÇÑË.È?
===>èáëè._ÁËË/ÅÁ.ÃÊ?_.èê(ë.È?.êá+è ë..,Ñ>À%`.ÊÁËø?>ËÁ.ÑÃ.`?Í.ÊÁÄÑÁÎÁ.ÈÇÑË.È?
===>ÈÁËÈ._ÁËË/ÅÁ.................
===>ÈÁËÈ._Á/ËË/ÅÁ............ÃÊ?_.ã/Ñ:/%.èê(ë
===>...(âñë(ß.<......... â+.............ãêì................................
******************************** Bottom of Data ********************************
this is the junk data am host receiving |
Now wouldn't you expect that if the data you are receiving is in CCSID 1208 and you are treating it as if it were CCSID 37 or 500 ??
Did the MF do a get with convert?
Does the MF allow a browse with the convert option?
You might want to look at the data in HEX and see if it matches what you would expect in CCSID 1208...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
zpat |
Posted: Thu Oct 20, 2011 10:17 pm Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
So you have a mainframe (did you mention this vital point?)!
No doubt you are looking at ASCII or Unicode as if it were EBCDIC.
First check the MQMD.CCSID is set correctly. Secondly look at the data using a tool that can convert it like MO71 or RFHUTILC (or, as said, in hex).
The application needs to use MQGET with MQGMO_CONVERT, in fact this is really a good standard. Then data is converted to the local codepage.
This is not "junk" data. It is good data being viewed through a different code page.
There are several "solutions", but you must first understand what you are looking at. |
|
Back to top |
|
 |
giridhararm |
Posted: Fri Oct 21, 2011 3:37 pm Post subject: |
|
|
Apprentice
Joined: 22 Apr 2009 Posts: 28
|
yes i checked it the host is mainframe i iwl lfollow the rest as adviced |
|
Back to top |
|
 |
mqjeff |
Posted: Sat Oct 22, 2011 5:37 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
giridhararm wrote: |
yes i checked it the host is mainframe i iwl lfollow the rest as adviced |
If you do more than just follow the advice, if you actually think about it and try and understand it... then next time you run into a similar issue, you might be able to solve it yourself. |
|
Back to top |
|
 |
rekarm01 |
Posted: Sat Oct 22, 2011 3:38 pm Post subject: Re: MQSTR |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
zpat wrote: |
The application needs to use MQGET with MQGMO_CONVERT, in fact this is really a good standard. Then data is converted to the local codepage. |
Or, if it's not possible to modify the receiving application, the sending application can just write the message in EBCDIC instead. |
|
Back to top |
|
 |
zpat |
Posted: Sat Oct 22, 2011 10:53 pm Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
There are many "solutions", but modifying the sending application is not recommended.
You could set up another sender channel to the mainframe and set convert data to YES on this channel. Then by using another xmit queue - route the message over this channel.
Of course you can change the existing channel, but that might affect other things. However fixing the receiving application is always the best way. |
|
Back to top |
|
 |
|