Producing a list of IBM MQ define commands (SDEFS) on z/OS®
We can use the SDEFS function of CSQUTIL to produce a list of DEFINE commands describing the objects in your queue manager or queue sharing group.
Both CSQUTIL SDEFS and the CSQUTIL COMMAND with the MAKEDEF option can be used to produce a set of MQSC commands to re-create the objects currently defined in the queue manager.
The difference between the two is that CSQUTIL COMMAND must be run against an active queue manager and is most appropriate for regular backup of object definitions, whereas CSQUTIL SDEFS can be used to re-create definitions for a queue manager that is not currently running. This makes the CSQUTIL SDEFS option more appropriate for recovery scenarios.
Command management (SDEFS)
Keywords and parameters
- OBJECT
- Specifies the type of object to be listed.
A value of QUEUE lists queues of all types, as if you had specified QALIAS, QLOCAL, QMODEL and QREMOTE.
- QSGDISP
- Specifies from where the object definition information is obtained. Depending on how the object
has been defined, this information is either:
- On the page set zero referred to by the CSQP0000 DD statement, or
- In a Db2® shared repository.
Permitted values are shown in Table 1.
Table 1. SDEFS QSGDISP parameters and their actions QSGDISP parameter What the SDEFS utility does QMGR Creates DEFINE statements for the specified object type from definitions held on the page set zero referred to by the CSQP0000 DD statement. (1) Only objects defined with QSGDISP(QMGR) are included.
COPY Creates DEFINE statements for the specified object type from definitions held on the page set zero referred to by the CSQP0000 DD statement. (1) Only objects defined with QSGDISP(COPY) are included.
PRIVATE Creates DEFINE statements for the specified object type from definitions held on the page set zero referred to by the CSQP0000 DD statement. (1) Both QSGDISP(QMGR) and QSGDISP(COPY) objects are included.
GROUP Creates DEFINE statements for the specified object type from definitions held on Db2 resource definition tables for the specified queue sharing group. Only objects defined with QSGDISP(GROUP) are included.
No CSQP0000 DD statement is required; the Db2 subsystem specified at object definition is accessed. The Db2 library db2qual.SDSNLOAD is required.
SHARED Creates DEFINE statements for all local queues defined with QSGDISP(SHARED) by accessing the Db2 resource definition table for the specified queue sharing group. This parameter is permitted only with OBJECT(QLOCAL) or OBJECT(QUEUE).
No CSQP0000 DD statement is required; the Db2 subsystem specified at object definition is accessed. The Db2 library db2qual.SDSNLOAD is required.
- MAKEDEF( ddname2 )
- Specifies that define commands generated for the object are to be placed in the output data set
identified by the DDname. The data set should be RECFM=FB, LRECL=80. This data set can then be used
as input for a later invocation of the COMMAND function or it can be incorporated into the
initialization data sets CSQINP1 and CSQINP2.
The commands generated are DEFINE NOREPLACE, with all the attributes and values for the object.
Note: DEFINE commands are not generated for any local queues that can be identified as dynamic, or for channels that were defined automatically.
Examples
Usage notes
- For local definitions, do not use SDEFS for a queue manager that is running because results will be unpredictable. We can avoid doing this accidentally by using DISP=OLD in the CSQP0000 DD statement. For shared or group queue definitions, this does not matter because the information is derived from Db2.
- When we use SDEFS for local queues we do not need to specify a queue manager name. However, for shared and group queue definitions, a queue manager name is required to access Db2.
- To use the SDEFS function more than once in a job, specify different DDnames and data sets for each invocation of the function, or specify a sequential data set and DISP=MOD in the DD statements.
- If the SDEFS function fails, no further CSQUTIL functions are attempted.
- The SDEFS function does not support the CHLAUTH, SUB, CFSTRUCT or QMGR objects. To back these objects up, use the CSQUTIL COMMAND function.