Use 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 Application Programming Reference for further information about these fields.
We can specify the destination queues in two ways:
- By using the offset field ObjectRecOffset.
In this case, the application must declare its own structure containing an MQOD structure, followed by the array of MQOR records (with as many array elements as are needed), and set ObjectRecOffset to the offset of the first element in the array from the start of the MQOD. Ensure that this offset is correct.
Use of built-in facilities provided by the programming language is recommended, if these are available in all the environments in which the application runs. The following illustrates this technique for the COBOL programming language:
01 MY-OPEN-DATA. 02 MY-MQOD. COPY CMQODV. 02 MY-MQOR-TABLE OCCURS 100 TIMES. COPY CMQORV. MOVE LENGTH OF MY-MQOD TO MQOD-OBJECTRECOFFSET.Alternatively, use the constant MQOD_CURRENT_LENGTH if the programming language does not support the necessary built-in facilities in all the environments concerned. The following illustrates this technique:
01 MY-MQ-CONSTANTS. COPY CMQV. 01 MY-OPEN-DATA. 02 MY-MQOD. COPY CMQODV. 02 MY-MQOR-TABLE OCCURS 100 TIMES. COPY CMQORV. MOVE MQOD-CURRENT-LENGTH TO MQOD-OBJECTRECOFFSET.However, this works correctly only if the MQOD structure and the array of MQOR records are contiguous; if the compiler inserts skip bytes between the MQOD and the MQOR array, these must be added to the value stored in ObjectRecOffset.Using ObjectRecOffset is recommended for programming languages that do not support the pointer data type, or that implement the pointer data type in a way that is not portable to different environments (for example, the COBOL programming language).
- By using the pointer field ObjectRecPtr.
In this case, the application can declare the array of MQOR structures separately from the MQOD structure, and set ObjectRecPtr to the address of the array. The following illustrates this technique for the C programming language:
MQOD MyMqod; MQOR MyMqor[100]; MyMqod.ObjectRecPtr = MyMqor;Using ObjectRecPtr is recommended for programming languages that support the pointer data type in a way that is portable to different environments (for example, the C programming language).
Whichever technique you choose, use one of ObjectRecOffset and ObjectRecPtr; the call fails with reason code MQRC_OBJECT_RECORDS_ERROR if both are zero, or both are nonzero.
Parent topic:
Opening distribution lists
fg12470_