Putting a message using MQPUT
This example demonstrates how to use the MQPUT call to put a message on a queue. This extract is not taken from the sample applications supplied with WebSphere MQ.
⋮ * CONNECT TO QUEUE MANAGER * CONN DS 0H ⋮ * * OPEN A QUEUE * OPEN DS 0H ⋮ * * R4,R5,R6,R7 = WORK REGISTER. * PUT DS 0H LA R4,MQMD SET UP ADDRESSES AND LA R5,MQMD_LENGTH LENGTH FOR USE BY MVCL LA R6,WMD INSTRUCTION, AS MQMD IS LA R7,WMD_LENGTH OVER 256 BYES LONG. MVCL R6,R4 INITIALIZE WORKING VERSION * OF MESSAGE DESCRIPTOR * MVC WPMO_AREA,MQPMO_AREA INITIALIZE WORKING MQPMO * LA R5,BUFFER_LEN RETRIEVE THE BUFFER LENGTH ST R5,BUFFLEN AND SAVE IT FOR MQM USE * MVC BUFFER,TEST_MSG SET THE MESSAGE TO BE PUT * * ISSUE MQI PUT REQUEST USING REENTRANT FORM * OF CALL MACRO * * HCONN WAS SET BY PREVIOUS MQCONN REQUEST * HOBJ WAS SET BY PREVIOUS MQOPEN REQUEST * CALL MQPUT, X (HCONN, X HOBJ, X WMD, X WPMO, X BUFFLEN, X BUFFER, X COMPCODE, X REASON),VL,MF=(E,CALLLST) * LA R5,MQCC_OK C R5,COMPCODE BNE BADCALL * ⋮ BADCALL DS 0H ⋮* * CONSTANTS * CMQMDA DSECT=NO,LIST=YES,PERSISTENCE=MQPER_PERSISTENT CMQPMOA DSECT=NO,LIST=YES CMQA TEST_MSG DC CL80'THIS IS A TEST MESSAGE' * * WORKING STORAGE DSECT * WORKSTG DSECT * COMPCODE DS F REASON DS F BUFFLEN DS F OPTIONS DS F HCONN DS F HOBJ DS F * BUFFER DS CL80 BUFFER_LEN EQU *-BUFFER * WMD CMQMDA DSECT=NO,LIST=NO WPMO CMQPMOA DSECT=NO,LIST=NO * CALLLST CALL ,(0,0,0,0,0,0,0,0,0,0,0),VL,MF=L * ⋮ END
Parent topic:
System/390 assembler-language examples
fg19120_