Opening objects using the MQOPEN call

Use this information to learn about opening objects using the MQOPEN call.

As input to the MQOPEN call, we must supply:

  • A connection handle. For CICS applications on z/OS, we can specify the constant MQHC_DEF_HCONN (which has the value zero), or use the connection handle returned by the MQCONN or MQCONNX call. For other programs, always use the connection handle returned by the MQCONN or MQCONNX call.
  • A description of the object that we want to open, using the object descriptor structure (MQOD).
  • One or more options that control the action of the call.

The output from MQOPEN is:

  • An object handle that represents your access to the object. Use this on input to any subsequent MQI calls.
  • A modified object-descriptor structure, if we are creating a dynamic queue (and it is supported on the platform).
  • A completion code.
  • A reason code.


Scope of an object handle

The scope of an object handle (Hobj) is the same as the scope of a connection handle (Hconn).

This is covered in Scope of MQCONN or MQCONNX and Shared (thread independent) connections with MQCONNX. However, there are additional considerations in some environments:

    CICS
    In a CICS program, we can use the handle only within the same CICS task from which you made the MQOPEN call.

    IMS and z/OS batch
    In the IMS and batch environments, we can use the handle within the same task, but not within any subtasks.

Descriptions of the parameters of the MQOPEN call are given in MQOPEN.

The following sections describe the information that we must supply as input to MQOPEN.


Identifying objects (the MQOD structure)

Use the MQOD structure to identify the object that we want to open. This structure is an input parameter for the MQOPEN call. (The structure is modified by the queue manager when we use the MQOPEN call to create a dynamic queue.)

For full details of the MQOD structure, see MQOD.

For information about using the MQOD structure for distribution lists, see Use the MQOD structure under Distribution lists.

Parent topic: Opening and closing objects