Previous Topic: MQ CONNECT—Provide Queue Manager ConnectionNext Topic: MQ GET—Retrieve Messages


MQ OPEN—Open a Queue

The ADDRESS MQ OPEN command lets you open a specific message queue.

This command has the following format:

ADDRESS MQ OPEN {QUEUE(name)|QMGR(name)} 
  {OPTIONS(DEFAULT|SHARED|EXCLUSIVE|BROWSE|OUTPUT|SET|INQUIRE)} 
  {CONHANDLE(varHCONN)} 
  {OBJHANDLE(varHOBJ)}
QUEUE

Defines the message queue name. The name is case sensitive and can be up to 48 bytes.

Mutually exclusive with QMGR.

QMGR

Defines the queue manager name. The name is case sensitive and can be up to 48 bytes.

Mutually exclusive with QUEUE.

OPTIONS

Specifies your access or other options.

DEFAULT

Indicates the default queue setting. The message is deleted from the queue.

SHARED

Indicates shared access. The message is deleted from the queue.

EXCLUSIVE

Indicates exclusive access. The message is deleted from the queue.

BROWSE

Indicates using browse mode to access the message queue. The message is kept on the queue.

OUTPUT

Indicates output mode. This option is necessary for putting messages on the queue.

SET

Indicates set mode. This option is necessary for setting the attributes of the queue.

INQUIRE

Indicates inquire mode. This option is necessary for inquiring which attributes of the queue or queue manager are set.

CONHANDLE(varHCONN)

Defines the variable name that stores the Connection Handle.

OBJHANDLE(varHOBJ)

Defines the variable name that stores the Object Handle.

Example: MQ OPEN

This example shows how to open a queue (QM2) for output.

ADDRESS MQ "OPEN QUEUE(QM2) OPTIONS(OUTPUT)",
           "CONHANDLE(hconn) OBJHANDLE(hobj)"