Producing a list of IBM MQ define commands (SDEFS)

You 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 recreate 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 recreate definitions for a queue manager that is not currently running. This makes the CSQUTIL SDEFS option more appropriate for recovery scenarios.

Command management (SDEFS)

Read syntax diagramSkip visual syntax diagram SDEFS OBJECT ( AUTHINFOCHANNELNAMELISTPROCESSQALIASQLOCALQMODELQREMOTEQUEUESTGCLASSTOPIC ) QSGDISP(QMGR)QSGDISP(COPY)QSGDISP(PRIVATE)QSGDISP(GROUP)QSGDISP(SHARED) MAKEDEF ( ddname2 )

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.

Notes:
  1. Because only page set zero is accessed, you must ensure that the queue manager is not running.
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

Figure 1. Sample JCL for the SDEFS function of CSQUTIL

//SDEFS   EXEC  PGM=CSQUTIL
//STEPLIB  DD   DISP=SHR,DSN=thlqual.SCSQANLE
//         DD   DISP=SHR,DSN=thlqual.SCSQAUTH
//CSQP0000 DD   DISP=OLD,DSN=pageset.dsname0  
//OUTPUT1  DD   DISP=OLD,DSN=MY.COMMANDS(DEFS)
//SYSPRINT DD   SYSOUT=*
//SYSIN    DD   *
SDEFS OBJECT(QUEUE) MAKEDEF(OUTPUT1)
/*
Figure 2. Sample JCL for the SDEFS function of CSQUTIL for objects in the Db2 shared repository

//SDEFS   EXEC  PGM=CSQUTIL,PARM='Qsgname,Dsgname,Db2name'
//STEPLIB  DD   DISP=SHR,DSN=thlqual.SCSQANLE
//         DD   DISP=SHR,DSN=thlqual.SCSQAUTH
//         DD   DISP=SHR,DSN=db2qual.SDSNLOAD
//OUTPUT1  DD   DISP=OLD,DSN=MY.COMMANDS(DEFS)
//SYSPRINT DD   SYSOUT=*
//SYSIN    DD   *
SDEFS OBJECT(QLOCAL) QSGDISP(SHARED) MAKEDEF(OUTPUT1)
/*
Figure 3. Sample JCL for the SDEFS function of CSQUTIL, when recovering all objects from a valid page set zero

//CSQUTIL JOB CLASS=A,MSGCLASS=H,NOTIFY=&SYSUID,REGION=0M
//PS00 EXEC PGM=CSQUTIL
//STEPLIB  DD DISP=SHR,DSN=thlqual.SCSQAUTH
//         DD DISP=SHR,DSN=thlqual.SCSQANLE
//CSQP0000 DD DISP=OLD,DSN=pageset.dsname0
//OUTPUT1  DD DISP=OLD,DSN=MY.COMMANDS(CHANNEL)
//OUTPUT2  DD DISP=OLD,DSN=MY.COMMANDS(AUTHINFO)
//OUTPUT3  DD DISP=OLD,DSN=MY.COMMANDS(NAMELIST)
//OUTPUT4  DD DISP=OLD,DSN=MY.COMMANDS(PROCESS)
//OUTPUT5  DD DISP=OLD,DSN=MY.COMMANDS(QALIAS)
//OUTPUT6  DD DISP=OLD,DSN=MY.COMMANDS(QLOCAL)
//OUTPUT7  DD DISP=OLD,DSN=MY.COMMANDS(QMODEL)
//OUTPUT8  DD DISP=OLD,DSN=MY.COMMANDS(QREMOTE)
//OUTPUT9  DD DISP=OLD,DSN=MY.COMMANDS(QUEUE)
//OUTPUT0  DD DISP=OLD,DSN=MY.COMMANDS(STGCLASS)
//OUTPUTA  DD DISP=OLD,DSN=MY.COMMANDS(TOPIC)
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
SDEFS OBJECT(CHANNEL) MAKEDEF(OUTPUT1)
SDEFS OBJECT(AUTHINFO) MAKEDEF(OUTPUT2)
SDEFS OBJECT(NAMELIST) MAKEDEF(OUTPUT3)
SDEFS OBJECT(PROCESS) MAKEDEF(OUTPUT4)
SDEFS OBJECT(QALIAS) MAKEDEF(OUTPUT5)
SDEFS OBJECT(QLOCAL) MAKEDEF(OUTPUT6)
SDEFS OBJECT(QMODEL) MAKEDEF(OUTPUT7)
SDEFS OBJECT(QREMOTE) MAKEDEF(OUTPUT8)
SDEFS OBJECT(QUEUE) MAKEDEF(OUTPUT9)
SDEFS OBJECT(STGCLASS) MAKEDEF(OUTPUT0)
SDEFS OBJECT(TOPIC) MAKEDEF(OUTPUTA)
/*

Usage notes

  1. For local definitions, do not use SDEFS for a queue manager that is running because results will be unpredictable. You 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.
  2. When you use SDEFS for local queues you 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.
  3. 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.
  4. If the SDEFS function fails, no further CSQUTIL functions are attempted.
  5. The SDEFS function does not support the CHLAUTH, SUB, CFSTRUCT or QMGR objects. To back these objects up, use the CSQUTIL COMMAND function.