Previous Topic: ADDRESS MQ Debug Parameter

Next Topic: ADDRESS MQ Return Codes

How to Use ADDRESS MQ Commands

The following process provides an example of how to use MQ commands.

We will do the following:

  1. Connect to the queue manager.
  2. Open the queue for output and setting.
  3. Inhibit the putting of the messages.
  4. Try to put the message (command will fail).
  5. Allow the putting of the messages.
  6. Try again to put the message with expiration time 5 minutes (command will work).
  7. Close the queue.
  8. Disconnect from the queue manager.

Using the following ADDRESS MQ commands:

(1) address MQ "CONNECT QMGR(CS01) CONHANDLE(CH)" 
(2) address MQ "OPEN QUEUE(CS01.MYQUEUE) OPTIONS(OUTPUT, SET)",
               "CONHANDLE(CH) OBJHANDLE(OH)" 
(3) MQ.INHIBIT_PUT = 1 
    address MQ "SET CONHANDLE(CH) OBJHANDLE(OH)", 
               "ATTRIBUTES(INHIBIT_PUT)" 
(4) MYDATA = "This message will not be on the queue." 
    address MQ "PUT CONHANDLE(CH) OBJHANDle(OH) DATA(MYDATA)" 
(5) MQ.INHIBIT_PUT = 0
    address MQ "SET CONHANDLE(CH) OBJHANDLE(OH)",
               "ATTRIBUTES(INHIBIT_PUT)"
(6) MYDATA = "This message will be on the queue." 
    address MQ "PUT CONHANDLE(CH) OBJHANDLE(OH) OPTIONS(EXPIRY(5 MINUTES))",
               "DATA(MYDATA)"
(7) address MQ "CLOSE CONHANDLE(CH) OBJHANDLE(OH)" 
(8) address MQ "DISCONNECT CONHANDLE(CH)"