Closing a queue
This example demonstrates how to use the MQCLOSE call.
The variables used in this code extract are those that were set in Connect to a queue manager. This extract is taken from the Browse sample application (program CSQ4BVA1) supplied with IBM MQ for z/OS. For the names and locations of the sample applications on other platforms, see Sample procedural programs (platforms except z/OS ).⋮ * * Close the queue * MOVE MQCO-NONE TO W03-OPTIONS. * CALL 'MQCLOSE' USING W03-HCONN W03-HOBJ W03-OPTIONS W03-COMPCODE W03-REASON. * * Test the output of the MQCLOSE call. If the call * fails, print an error message showing the * completion code and reason code. * IF (W03-COMPCODE NOT = MQCC-OK) THEN MOVE 'CLOSE' TO W04-MSG4-TYPE MOVE W03-COMPCODE TO W04-MSG4-COMPCODE MOVE W03-REASON TO W04-MSG4-REASON MOVE W04-MESSAGE-4 TO W00-PRINT-DATA PERFORM PRINT-LINE MOVE W06-CSQ4-ERROR TO W00-RETURN-CODE END-IF. *Parent topic: COBOL examples