Set the attributes of a queue
This example demonstrates how to use the MQSET call to change the attributes of a queue. This extract is taken from the Queue Attributes sample application (program CSQ4CVC1) supplied with WebSphere MQ for z/OS. For the names and locations of the sample applications on other platforms, see
⋮ * -------------------------------------------------------* WORKING-STORAGE SECTION. * -------------------------------------------------------* * * W02 - MQM API fields * 01 W02-SELECTORCOUNT PIC S9(9) BINARY VALUE 2. 01 W02-INTATTRCOUNT PIC S9(9) BINARY VALUE 2. 01 W02-CHARATTRLENGTH PIC S9(9) BINARY VALUE ZERO. 01 W02-CHARATTRS PIC X VALUE LOW-VALUES. 01 W02-HCONN PIC S9(9) BINARY VALUE ZERO. 01 W02-HOBJ PIC S9(9) BINARY. 01 W02-COMPCODE PIC S9(9) BINARY. 01 W02-REASON PIC S9(9) BINARY. 01 W02-SELECTORS-TABLE. 05 W02-SELECTORS PIC S9(9) BINARY OCCURS 2 TIMES. 01 W02-INTATTRS-TABLE. 05 W02-INTATTRS PIC S9(9) BINARY OCCURS 2 TIMES. * * CMQODV defines the object descriptor (MQOD). * 01 MQM-OBJECT-DESCRIPTOR. COPY CMQODV. * * CMQV contains constants (for setting or testing * field values) and return codes (for testing the * result of a call). * 01 MQM-CONSTANTS. COPY CMQV SUPPRESS. * -------------------------------------------------------* PROCEDURE DIVISION. * -------------------------------------------------------** * Get the queue name and open the queue. * ⋮ * * * Initialize the variables required for the set call: * - Set W02-SELECTORS-TABLE to the attributes to be set * - Set W02-INTATTRS-TABLE to the required status * - All other variables are already set * MOVE MQIA-INHIBIT-GET TO W02-SELECTORS(1). MOVE MQIA-INHIBIT-PUT TO W02-SELECTORS(2). MOVE MQQA-GET-INHIBITED TO W02-INTATTRS(1). MOVE MQQA-PUT-INHIBITED TO W02-INTATTRS(2). * * Set the attributes. * CALL 'MQSET' USING W02-HCONN, W02-HOBJ, W02-SELECTORCOUNT, W02-SELECTORS-TABLE, W02-INTATTRCOUNT, W02-INTATTRS-TABLE, W02-CHARATTRLENGTH, W02-CHARATTRS, W02-COMPCODE, W02-REASON. * * Test the output from the call: * * - If the completion code is not OK, display an error * message showing the completion and reason codes * * - Otherwise, move 'INHIBITED' into the relevant * screen map fields * IF W02-COMPCODE NOT = MQCC-OK MOVE 'MQSET' TO M01-MSG4-OPERATION MOVE W02-COMPCODE TO M01-MSG4-COMPCODE MOVE W02-REASON TO M01-MSG4-REASON MOVE M01-MESSAGE-4 TO M00-MESSAGE ELSE * * Process the changes. ⋮ END-IF.
Parent topic:
COBOL examples
fg19050_