Putting a message using MQPUT1

This example demonstrates how to use the MQPUT1 call. This extract is taken from the Credit Check sample application (program CSQ4CVB5) supplied with WebSphere MQ for z/OS. For the names and locations of the sample applications on other platforms, see Sample programs (all platforms except z/OS).



  ·
  ·
  ·
* -------------------------------------------------------* WORKING-STORAGE SECTION. * -------------------------------------------------------* * * W03 - MQM API fields * 01 W03-HCONN PIC S9(9) BINARY VALUE ZERO. 01 W03-OPTIONS PIC S9(9) BINARY. 01 W03-COMPCODE PIC S9(9) BINARY. 01 W03-REASON PIC S9(9) BINARY. 01 W03-BUFFLEN PIC S9(9) BINARY. * 01 W03-PUT-BUFFER. 05 W03-CSQ4BQRM. COPY CSQ4VB4.
*
*    API control blocks
*
 01  MQM-OBJECT-DESCRIPTOR.
     COPY CMQODV.
 01  MQM-MESSAGE-DESCRIPTOR.
     COPY CMQMDV.
 01  MQM-PUT-MESSAGE-OPTIONS.
     COPY CMQPMOV.
*
* CMQV contains constants (for filling in the
* control blocks) and return codes (for testing
* the result of a call).
*
 01  MQM-MQV.
 COPY CMQV SUPPRESS.
* -------------------------------------------------------*
 PROCEDURE DIVISION.
* -------------------------------------------------------*

  ·
  ·
  ·
* Get the request message.
  ·
  ·
  ·
* -------------------------------------------------------* PROCESS-QUERY SECTION. * -------------------------------------------------------*
  ·
  ·
  ·
* Build the reply message.
  ·
  ·
  ·
* * Set the object descriptor, message descriptor and * put-message options to the values required to create * the message. * Set the length of the message. * MOVE MQMD-REPLYTOQ TO MQOD-OBJECTNAME. MOVE MQMD-REPLYTOQMGR TO MQOD-OBJECTQMGRNAME. MOVE MQMT-REPLY TO MQMD-MSGTYPE. MOVE SPACES TO MQMD-REPLYTOQ. MOVE SPACES TO MQMD-REPLYTOQMGR. MOVE LOW-VALUES TO MQMD-MSGID. COMPUTE MQPMO-OPTIONS = MQPMO-SYNCPOINT + MQPMO-PASS-IDENTITY-CONTEXT. MOVE W03-HOBJ-CHECKQ TO MQPMO-CONTEXT. MOVE LENGTH OF CSQ4BQRM-MSG TO W03-BUFFLEN. * CALL 'MQPUT1' USING W03-HCONN MQOD MQMD MQPMO W03-BUFFLEN W03-PUT-BUFFER W03-COMPCODE W03-REASON. IF W03-COMPCODE NOT = MQCC-OK MOVE 'MQPUT1' TO M02-OPERATION MOVE MQOD-OBJECTNAME TO M02-OBJECTNAME PERFORM RECORD-CALL-ERROR PERFORM FORWARD-MSG-TO-DLQ END-IF. *