Sample OPTIONS control statements

Use the sample control statements as models for developing your own OPTIONS control statements.

Example 1: Checking control statement syntax and previewing lists and TEMPLATE data set names

The following OPTIONS statement specifies that the subsequent utility control statements are to run in PREVIEW mode. In PREVIEW mode, Db2 checks for syntax errors in all utility control statements, but normal utility execution does not take place. If the syntax is valid, Db2 expands the CPYLIST list and the data set names in the COPYLOC and COPYREM TEMPLATE utility control statements and prints these results to the SYSPRINT data set.

OPTIONS PREVIEW
TEMPLATE COPYLOC UNIT(SYSDA)
         DSN(&DB..&TS..D&JDATE..&STEPNAME..COPY&IC.&LOCREM.&PB.)
         DISP(NEW,CATLG,CATLG) SPACE(200,20) TRK
         VOLUMES(SCR03)
TEMPLATE COPYREM UNIT(SYSDA)
         DSN(&DB..&TS..&UT..T&TIME..COPY&IC.&LOCREM.&PB.)
         DISP(NEW,CATLG,CATLG) SPACE(100,10) TRK
LISTDEF CPYLIST INCLUDE TABLESPACES DATABASE DBLT0701
COPY LIST CPYLIST FULL YES
     COPYDDN(COPYLOC,COPYLOC)
     RECOVERYDDN(COPYREM,COPYREM)
     SHRLEVEL REFERENCE
 

Example 2: Specifying LISTDEF and TEMPLATE definition libraries

In the following example, the OPTIONS control statements specify the DD names of the LISTDEF definition libraries and the TEMPLATE definition libraries.

The first OPTIONS statement specifies that the LISTDEF definition library is identified by the V1LIST DD statement and the TEMPLATE definition library is identified by the V1TEMPL DD statement. These definition libraries apply to the subsequent COPY utility control statement. Therefore, if Db2 does not find the PAYTBSP list in SYSIN, it searches the V1LIST library, and if Db2 does not find the PAYTEMP1 template in SYSIN, it searches the V1TEMP library.

The second OPTIONS statement is similar to the first, but it identifies different libraries and applies to the second COPY control statement. This second COPY control statement looks similar to the first COPY job. However, this statement processes a different list and uses a different template. Whereas the first COPY job uses the PAYTBSP list from the V1LIST library, the second COPY job uses the PAYTBSP list from the V2LIST library. Also, the first COPY job uses the PAYTEMP1 template from the V1TEMPL library, the second COPY job uses the PAYTEMP1 template from the V2TEMPL library.

OPTIONS LISTDEFDD V1LIST TEMPLATEDD V1TEMPL 
COPY LIST PAYTBSP COPYDDN(PAYTEMP1,PAYTEMP1) 

OPTIONS LISTDEFDD V2LIST TEMPLATEDD V2TEMPL 
COPY LIST PAYTBSP COPYDDN(PAYTEMP1,PAYTEMP1)

Example 3: Forcing a return code 0

In the following example, the first OPTIONS control statement forces a return code of 0 for the subsequent MODIFY RECOVERY utility control statement. Ordinarily, this statement ends with a return code of 4 because it specifies that Db2 is to delete all SYSCOPY and SYSLGRNX records for table space A.B. The second OPTIONS control statement restores the default options, so that no return codes will be overridden for the second MODIFY RECOVERY control statement.

OPTIONS EVENT(WARNING,RC0) 
MODIFY RECOVERY TABLESPACE A.B DELETE AGE(*) 
OPTIONS OFF 
MODIFY RECOVERY TABLESPACE C.D DELETE AGE(30)

Example 4: Checking syntax and skipping errors while processing list objects

In the following control statement, the first OPTIONS utility control statement specifies that the subsequent utility control statements are to run in PREVIEW mode. In PREVIEW mode, Db2 checks for syntax errors in all utility control statements, but normal utility execution does not take place. If the syntax is valid, Db2 expands the three lists (LIST1_LISTDEF, LIST2_LISTDEF, and LIST3_LISTDEF) and prints these results to the SYSPRINT data set.

The second OPTIONS control statement specifies how Db2 is to handle return codes of 8 in any subsequent utility statements that process a valid list. If processing of a list item produces return code 8, Db2 skips that item, and continues to process the rest of the items in the list, but Db2 does not process the next utility control statement. Instead, the job ends with return code 8.

   OPTIONS PREVIEW
   LISTDEF COPY1_LISTDEF
               INCLUDE TABLESPACES TABLESPACE DSNDB01.SPT01
               INCLUDE TABLESPACES TABLESPACE DSNDB06.SYSGPAUT
               INCLUDE TABLESPACES TABLESPACE DBA91302.T?A9132*
   LISTDEF COPY2_LISTDEF
               INCLUDE TABLESPACES TABLESPACE DBA91303.TLA9133A
               INCLUDE TABLESPACES TABLESPACE DBA91303.TSA9133B
               INCLUDE TABLESPACES TABLESPACE DBA91303.TPA9133C
               INCLUDE TABLESPACES TABLESPACE DBA91304.TLA9134A
               INCLUDE TABLESPACES TABLESPACE DSNDB06.SYSUSER
               INCLUDE TABLESPACES TABLESPACE DSNDB06.SYSSTATS
               INCLUDE TABLESPACES TABLESPACE DSNDB06.SYSDDF
   LISTDEF COPY3_LISTDEF
               INCLUDE TABLESPACES TABLESPACE DBA91304.TSA9134B
               INCLUDE TABLESPACES TABLESPACE DSNDB06.SYSHIST
               INCLUDE TABLESPACES TABLESPACE DSNDB06.SYSGRTNS
               INCLUDE TABLESPACES TABLESPACE DSNDB06.SYSJAVA
               INCLUDE TABLESPACES TABLESPACE DBA91304.TPA9134C
   OPTIONS EVENT(ITEMERROR,SKIP)
   TEMPLATE TMP1 UNIT(SYSDA) DISP(MOD,CATLG,CATLG)
            VOLUMES(SCR03)
            DSN(DH109013.&TS..COPY&ICTYPE.&LOCREM.&PRIBAC.)
   COPY LIST COPY1_LISTDEF SHRLEVEL REFERENCE
        COPYDDN (TMP1)
        RECOVERYDDN (TMP1)
        FULL YES
   COPY LIST COPY2_LISTDEF SHRLEVEL REFERENCE
        COPYDDN (TMP1,TMP1)
        FULL YES
   COPY LIST COPY3_LISTDEF SHRLEVEL REFERENCE
        COPYDDN (TMP1,TMP1)
        RECOVERYDDN (TMP1,TMP1)
        FULL YES