ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ API Support » MSgID and CorrID

Post new topic  Reply to topic
 MSgID and CorrID « View previous topic :: View next topic » 
Author Message
nik_iway
PostPosted: Thu Oct 20, 2005 8:40 pm    Post subject: MSgID and CorrID Reply with quote

Centurion

Joined: 21 Jul 2005
Posts: 115

Hi everybody,

I am doing a request reply scenario where i need to i dentify a valid reply for a specific request.

i am issuing my MQPUT on the client side by specifying

COMPUTE MQPMO-OPTIONS = MQPMO-NO-SYNCPOINT + MQPMO-FAIL-IF-QUIESCING.

MOVE WS-INPUT-Q TO MQMD-REPLYTOQ.
MOVE WS-INPUT-Q TO MQMD-MSGTYPE.
CALL 'MQPUT' USING CON-HANDLE
OPO-Q-HANDLE
MQMD
MQPMO
OUTPUT-BUFFER-LENGTH
WS-OUTPUT-BUFFER
COMP-CODE
REASON-CODE.
MOVE 'MQPUT' TO PRT-COMMAND.
MOVE COMP-CODE TO PRT-COMP-CODE.
MOVE REASON-CODE TO PRT-REASON-CODE.
ACCEPT PRT-LOG-TIME FROM TIME.
MOVE PRT-LOG-MESSAGE TO WS-PRINT-LINE.
PERFORM 8000-PRINT-LINE.
MQ-PUT-EXIT.
EXIT.

i wait for the reply in reply to queue
i issue the following MQGET call
MOVE MQMI-NONE TO MQMD-MSGID.
MOVE MQCI-NONE TO MQMD-CORRELID

COMPUTE MQGMO-OPTIONS = MQGMO-WAIT +
MQGMO-ACCEPT-TRUNCATED-MSG +
MQMO_MATCH_CORREL_ID +
MQGMO-NO-SYNCPOINT +
MQGMO-FAIL-IF-QUIESCING

On the SERVER sidde
i create a variable and pass the incoming MQMD message-ID to that variable in the Working storage area

SAVED-MSGID PIC X(24).

and after the MQGET i pass the MQMD-MEssage ID into SAVED-MSGID

MQ-GET SECTION.

MOVE MQMI-NONE TO MQMD-MSGID.
MOVE MQCI-NONE TO MQMD-CORRELID.
*
COMPUTE MQGMO-OPTIONS = MQGMO-WAIT +
MQGMO-ACCEPT-TRUNCATED-MSG +
MQGMO-NO-SYNCPOINT +
MQGMO-FAIL-IF-QUIESCING.
* Wait up to 30 seconds.
MOVE 30000 TO MQGMO-WAITINTERVAL.
*
CALL 'MQGET' USING CON-HANDLE
OPI-Q-HANDLE
MQMD
MQGMO
INPUT-BUFFER-LENGTH
WS-OUTPUT-BUFFER
RETURNED-LENGTH
COMP-CODE
REASON-CODE.

*
MOVE 'MQGET' TO PRT-COMMAND.
MOVE COMP-CODE TO PRT-COMP-CODE.
MOVE REASON-CODE TO PRT-REASON-CODE.
ACCEPT PRT-LOG-TIME FROM TIME.
MOVE PRT-LOG-MESSAGE TO WS-PRINT-LINE.
PERFORM 8000-PRINT-LINE.

4500-MQ-GET-EXIT.
EXIT.
MOVE MQMD-MSGID TO SAVED-MSGID.

before the the MQPUT operation i moved the SAVED-MSGID into the MQMD-CORRELATION ID

MOVE SAVED-MSGID TO MQMD-CORRELID


and do the MQPUT with the following operations

4000-MQ-PUT SECTION.

COMPUTE MQPMO-OPTIONS = MQPMO-NO-SYNCPOINT +
MQPMO-FAIL-IF-QUIESCING.
MOVE MQMT-REPLY TO MQMD-MSGTYPE.
*
CALL 'MQPUT' USING CON-HANDLE
OPO-Q-HANDLE
MQMD
MQPMO
OUTPUT-BUFFER-LENGTH
WS-OUTPUT-BUFFER
COMP-CODE
REASON-CODE.
*
MOVE 'MQPUT' TO PRT-COMMAND.
MOVE COMP-CODE TO PRT-COMP-CODE.
MOVE REASON-CODE TO PRT-REASON-CODE.
ACCEPT PRT-LOG-TIME FROM TIME.
MOVE PRT-LOG-MESSAGE TO WS-PRINT-LINE.
PERFORM 8000-PRINT-LINE.

4000-MQ-PUT-EXIT.
EXIT

i am a learner and i am using of the examples given by the capitalware. Can anybody tell me if ther are any mistakes in my code and wat does it mean by
MOVE MQMI-NONE TO MQMD-MSGID.
MOVE MQCI-NONE TO MQMD-CORRELID.

Waiting for your reply
Thanking you
Back to top
View user's profile Send private message
EddieA
PostPosted: Thu Oct 20, 2005 9:19 pm    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

The way you have explained things, it's difficult to follow what code is from the client and what is the server. Anyway, some observations:
Quote:
MOVE WS-INPUT-Q TO MQMD-MSGTYPE.

A queue name is not a message type.
Quote:
MOVE MQMI-NONE TO MQMD-MSGID.
MOVE MQCI-NONE TO MQMD-CORRELID

COMPUTE MQGMO-OPTIONS = MQGMO-WAIT +
MQGMO-ACCEPT-TRUNCATED-MSG +
MQMO_MATCH_CORREL_ID +
MQGMO-NO-SYNCPOINT +
MQGMO-FAIL-IF-QUIESCING

You are asking the GET to match on a CorrelationID, but by using MQCI_NONE, you are saying that any CorrelationID will match.
Quote:
wat does it mean by
MOVE MQMI-NONE TO MQMD-MSGID.
MOVE MQCI-NONE TO MQMD-CORRELID

For a PUT, it means you want the Queue Manager to generate a MessagID for you, and you don't want a CorrelationID set.

For a GET, it means that you want to read the next message off the queue, no matter what it's MesageID and CorrelationID are..

The normal pattern for a Client, is before the PUT, you set MessageID and CorrelationID to NONE. After the PUT, you extract the MessageID that MQ has filled in for you. You then issue a GET with Wait, setting the MessageID to NONE and the CorrelationID to the MesageID you just captured. That way, you will only GET a message that matches.

For the Server, you always GET with MesageID and CorrelationID set to NONE. That way you always get every message. Before sending the reply, you move the incoming MessageID into CorelationID, and then set MessageID to NONE. That way the Client will be able to identify the message.

And after every MQ operation, you should check the Completion/Return codes.

Cheers,
_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
nik_iway
PostPosted: Thu Oct 20, 2005 9:37 pm    Post subject: Thanks EddieA Reply with quote

Centurion

Joined: 21 Jul 2005
Posts: 115

EddieA :
After the PUT, you extract the MessageID that MQ has filled in for you

How do we extract the Message ID that MQ has filled?
Back to top
View user's profile Send private message
EddieA
PostPosted: Thu Oct 20, 2005 10:20 pm    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

Quote:
How do we extract the Message ID that MQ has filled

MOVE MQMD-MSGID TO ...

Cheers,
_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » MSgID and CorrID
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.