Author |
Message
|
Mohan_j |
Posted: Sat Jul 24, 2004 5:57 pm Post subject: MsgID and CorrelID |
|
|
Newbie
Joined: 21 Apr 2002 Posts: 8 Location: US
|
I am using a plain batch OS/390 program to put a message on queue. I set a correlID by having statement MOVE 'ABCD' TO MQMD-CORRELID. Then i performed MQPut on the queue.
I see that message fall on the queue and when i browse the message i see that the MQMD-CORRELID value comes as X'C1C2C3C44040404040'
1) Why is this happening ?
2) If i have a second application which waits on a particular correlid how do i set the value of correlid to wait on the queue ?
Any help would be of great value.
Thanks. |
|
Back to top |
|
 |
kirani |
Posted: Sat Jul 24, 2004 10:07 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
Mohan_j wrote: |
1) Why is this happening ?
|
What do you mean? Are you referring to Hex values in CorrelId? If so, Correl-id is 24 byte Binary field. That's why you see hexadecimal (EBCDIC) values for each char.
Mohan_j wrote: |
2) If i have a second application which waits on a particular correlid how do i set the value of correlid to wait on the queue ?
|
Use the similar code to set the CorrelId in MQMD header. You will then pass the same header to MQGET call. MQ will browse the queue and try to get the message that matches this (passed) correl-id. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
fjb_saper |
Posted: Sun Jul 25, 2004 6:53 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Quote: |
I set a correlID by having statement MOVE 'ABCD' TO MQMD-CORRELID |
ALWAYS A BAD IDEA. The correlation ID should just be the message ID of the request message.
Remember the messageid and correlationid fields are treated in BINARY.
Putting 'ABC' on it in EBCDIC will not give you 'ABC' in ASCII.
You should always treat these fields as a byte array and NEVER as Strings! Please read the manuals!
 |
|
Back to top |
|
 |
PeterPotkay |
Posted: Mon Jul 26, 2004 6:33 am Post subject: |
|
|
 Poobah
Joined: 15 May 2001 Posts: 7722
|
Quote: |
ALWAYS A BAD IDEA. The correlation ID should just be the message ID of the request message.
|
I wouldn't say its always a bad idea.
The default behaviour for a reply message is to move the Message ID (MID) of the request into the CorrelID (CID) of the reply. But if the requesting app sets Report options saying CID to CID or MID to MID, that is what your app should do.
On the requesting side, usually you leave the CID field blank, but sometimes you do put a value in there if you need to. We have a MF app that puts some key data in the CI field that helps us tie that message to a particular transaction on the MF. That CID is maintained roundtrip as it goes thru Windows and Solaris servers, and then the MF app does a get by CID on the reply.
If that message gets stuck on any of the queues along the way, we can tell what MF transaction is effected by looking at the CID. Meanwhile the QM is creating a guaranteed uniqueu MID for the message. _________________ Peter Potkay
Keep Calm and MQ On |
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Jul 26, 2004 9:43 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Peter I stand corrected.
Thanks for sharing your scenario.
However as you specify the correlation Id is created on the MF, maintained throughout the other environments and automatically checked on the MF again.
Typically any fetching with a correlation id has the said correlation id set and checked in the same environment. All other environments just maintain the value.
The trick of moving the messageid to the correlationid is to allow a value that was set in the source environment to be returned by the server to that same source environment... in the absence of any specified value.
 |
|
Back to top |
|
 |
Mohan_j |
Posted: Wed Jul 28, 2004 12:45 pm Post subject: |
|
|
Newbie
Joined: 21 Apr 2002 Posts: 8 Location: US
|
Thanks all for your suggestions and help.
The application runs fine now.I am moving the message id to correlid and firing the message and then waiting on a reply with the same correlid.. |
|
Back to top |
|
 |
|