Opening distribution lists

Use the MQOPEN call to open a distribution list, and use the options of the call to specify what you want to do with the list.

As input to MQOPEN, you must supply:

The output from MQOPEN is:

Using the MQOD structure

Use the MQOD structure to identify the queues that you want to open. To define a distribution list, you must specify MQOD_VERSION_2 in the Version field, a value greater than zero in the RecsPresent field, and MQOT_Q in the ObjectType field. See the WebSphere MQ Application Programming Reference for a description of all the fields of the MQOD structure.

Using the MQOR structure

Provide an MQOR structure for each destination. The structure contains the destination queue and queue manager names. The ObjectName and ObjectQMgrName fields in the MQOD are not used for distribution lists. There must be one or more object records. If the ObjectQMgrName is left blank, the local queue manager is used. See the WebSphere MQ Application Programming Reference for further information about these fields.

You can specify the destination queues in two ways:

Whichever technique you choose, you must use one of ObjectRecOffset and ObjectRecPtr; the call fails with reason code MQRC_OBJECT_RECORDS_ERROR if both are zero, or both are nonzero.

Using the MQRR structure

These structures are destination specific; each Response Record contains a CompCode and Reason field for each queue of a distribution list. You must use this structure to enable you to distinguish where any problems lie.

For example, if you receive a reason code of MQRC_MULTIPLE_REASONS and your distribution list contains five destination queues, you will not know which queues the problems apply to if you do not use this structure. However, if you have a completion code and reason code for each destination, you can locate the errors more easily.

See the WebSphere MQ Application Programming Reference for further information about the MQRR structure.

Figure 6 shows how you can open a distribution list in C.

Figure 6. Opening a distribution list in C. The MQOD uses pointers to the MQOR and MQRR structures.
 The diagram shows an MQOD (Object Descriptor) data structure. The version number  is identified as 2. The structure contains    The number of MQOR and MQRR entries A pointer to a separate  MQOR (Object Record) structure A pointer to a separate MQRR (Response Record) structure.  These structures are also shown, and each contains a list  with the same number of entries. The number was given in the MQOD.  The MQOR entries have fields for destination queue name and queue manager name. The MQRR entries have fields for Completion Code and Reason Code.

Figure 7 shows how you can open a distribution list in COBOL.

Figure 7. Opening a distribution list in COBOL. The MQOD uses offsets in COBOL.
 The diagram shows an MQOD (Object Descriptor) data structure. The version number  is identified as 2. The structure contains two offsets that identify where in the MQOD the list of MQOR (Object Record) and MQRR (Response Record) values are found. The MQOR entries have fields for  destination queue name and queue manager name. The MQRR entries have fields for Completion Code and Reason Code.

Using the MQOPEN options

You can specify the following options when opening a distribution list:

See Opening and closing objects for a description of these options.