IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to send MSGID & CORRELID for the Message Type REQUEST


IBM Mainframe Forums -> Java & MQSeries
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Sathiyendran

New User


Joined: 17 Jul 2015
Posts: 5
Location: India

PostPosted: Mon Jul 20, 2015 2:08 pm
Reply with quote

Need to send a message to the another application with MsgId and CorrelId , this message require a response. Below option was used in cobol code

MOVE MQMT-REQUEST TO MQMD-TYPE
MOVE MQMI-NONE TO MQMD-MSD-ID
MOVE MQCI-NONE TO MQMD-CORRELID

After writing the the data thru MQPUT/MQPUT1, we need to retrieve the corresponding response from Reply MQ. If we use below option, how program knows this a reponse for the earlier message sent.

MOVE MQMI-NONE TO MQMD-MSGID.
MOVE MQCI-NONE TO MQMD-CORRELID.

CALL 'MQGET' USING MQ-HCONN
MQ-NATIVE-HOBJ
MQMD
MQGMO

how source system know the MsgId and CorrelId for the each message sent to destination application ? because source system must know the MsgId and CorrelId to read the corresponding response from Reply MQ
Back to top
View user's profile Send private message
Sathiyendran

New User


Joined: 17 Jul 2015
Posts: 5
Location: India

PostPosted: Wed Jul 22, 2015 2:53 pm
Reply with quote

This was the code written to send a message to another application.

MOVE WS-QUEUE-ALIAS TO MQOD-OBJECTNAME.
MOVE WS-REPLY-QUEUE-ALIAS TO MQMD-REPLYTOQ
MOVE SPACES TO MQMD-REPLYTOQMGR
MOVE MQMT-REQUEST TO MQMD-MSGTYPE
MOVE MQMI-NONE TO MQMD-MSGID
MOVE MQMI-NONE TO MQMD-CORRELID
MOVE MQPER-PERSISTENT TO MQMD-PERSISTENCE.

COMPUTE MQPMO-OPTIONS = MQPMO-SYNCPOINT
+ MQPMO-NEW-MSG-ID
+ MQPMO-NEW-CORREL-ID
+ MQPMO-FAIL-IF-QUIESCING.

DISPLAY 'NEW MSG ID : ' MQMD-MSGID
DISPLAY 'NEW COR ID : ' MQMD-CORRELID

CALL 'MQPUT1' USING MQ-HCONN,
MQ-OBJ-DESCRIPTOR,
MQ-MSG-DESCRIPTOR,
MQ-PUT-OPTIONS,
MQ-MESSAGE-LENGTH,
MQ-MESSAGE-DATA,
MQ-COMPLETION-CODE,
MQ-REASON.

Please review and update whether the above code will generate MsgId and correlId and sent to another app.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Wed Jul 22, 2015 5:43 pm
Reply with quote

What is wrong with your testing system?
Back to top
View user's profile Send private message
Sathiyendran

New User


Joined: 17 Jul 2015
Posts: 5
Location: India

PostPosted: Thu Jul 23, 2015 1:39 pm
Reply with quote

I'm able to place a message successfully. When I need to retrieve the corresponding response from Reply MQ, I would need the MsgId and CorrelId.

how do I know these ?

Receiver might received the MsgId and CorrelId and they will reply based on this but when we retrieve we need to supply the ids to get corresponding response .. correct ?
Back to top
View user's profile Send private message
Garry Carroll

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Thu Jul 23, 2015 2:07 pm
Reply with quote

The process for matching MsgId/CorrelId is very straightforward and requires collaboration between the message sender (client) and the responder (server).

By coding
Code:
MOVE MQMI-NONE TO MQMD-MSGID.
the client MQPUT(1) causes MQ to populate the MsgId field in the request message descriptor with a value unique to that QManager. This then flows with the message to the server.

At the server side, the receiving application's MQGET retrieves this MsgId and the application then places it in the CorrelId field of the reply message's message descriptor.

At the client side, the client application places the MsgId which was generated (available after the MQPUT(1)) in the CorrelId field of the message descriptor for the MQGET.

Since the MsgId and CorrelId are being moved between request and response, it is good practice to have separate message descriptors for each in the applications.

Hope this clarifies,,

Garry.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Java & MQSeries

 


Similar Topics
Topic Forum Replies
This topic is locked: you cannot edit posts or make replies. how can I proof that message was post... Java & MQSeries 1
No new posts IMS Message : DFS3577A IMS DB/DC 4
No new posts SMF record type 30 JCL & VSAM 8
No new posts REXX to send an email in Mainframe wi... CLIST & REXX 3
No new posts REXX to send an email in Mainframe CLIST & REXX 4
Search our Forums:

Back to Top