Sample COPYTOCOPY control statements
Use the sample control statements as models for developing your own COPYTOCOPY control statements.
Example 1: Making a local backup copy
The following control statement specifies that the COPYTOCOPY utility is to make a local backup copy of the most recent full image copy or incremental image copy, whichever is most recent. The COPYDDN option specifies that the data set for the local site backup image copy is defined by the COPY2 DD statement. Because no data set is specified for the local site primary image copy, which is usually the first parameter of the COPYDDN option, COPYTOCOPY expects this copy to already exist. If it does not exist, Db2 issues an error message and terminates the job.
//STEP1 EXEC DSNUPROC,UID='DH109001.COPY1',
// UTPROC='',
// SYSTEM='DSN'
//COPY2 DD DSN=DH109001.C2C01.STEP2.COPY2,DISP=(MOD,CATLG,CATLG),
// SPACE=(1000,(20,20),,,ROUND)
//SYSIN DD *
COPYTOCOPY TABLESPACE DBA90101.TLA9011A COPYDDN(,COPY2)
//
Example 2: Copying the most recent copy
The following control statement specifies that COPYTOCOPY is to make a local site backup copy, a recovery site primary copy, and a recovery site backup copy of table space DBA90102.TPA9012C. The COPYDDN and RECOVERYDDN options also indicate the data sets to which these copies should be written. For example, the recovery site primary copy is to be written to the COPY3 data set. The FROMLASTCOPY option specifies that the most recent full image copy or incremental image copy is to be used as the input copy data set. This option is the default and is therefore not required.
COPYTOCOPY TABLESPACE DBA90102.TPA9012C
FROMLASTCOPY COPYDDN(,COPY2)
RECOVERYDDN(COPY3,COPY4)
Example 3: Copying the most recent full image copy
The following control statement specifies that COPYTOCOPY is to make primary and backup copies at the recovery site of table space DBA90201.TPA9021C. The FROMLASTFULLCOPY option specifies that the most recent full image copy is to be used as the input copy data set.
COPYTOCOPY TABLESPACE DBA90201.TPA9021C
FROMLASTFULLCOPY
RECOVERYDDN(COPY3,COPY4)
Example 4: Specifying a copy data set for input
The following control statement specifies that COPYTOCOPY is to make a local site backup copy, a recovery site primary copy, and a recovery site backup copy from data set DH109003.COPY1.STEP1.COPY3. This input data set is specified by the FROMCOPY option. The output data sets (COPY2, COPY3, and COPY4) are specified by the COPYDDN and RECOVERYDDN options.
COPYTOCOPY TABLESPACE DBA90301.TPA9031C
FROMCOPY DH109003.COPY1.STEP1.COPY3
COPYDDN(,COPY2)
RECOVERYDDN(COPY3,COPY4)
Example 5: Identifying a cataloged image copy data set
The following control statement specifies that COPYTOCOPY is to make a local site backup copy from a cataloged data set that is named DH109003.COPY1.STEP1.COPY4. This data set is identified by the FROMCOPY and FROMVOLUME options. The FROMCOPY option specifies the input data set name, and the FROMVOLUME CATALOG option indicates that the input data set is cataloged. Use the FROMVOLUME option to distinguish a data set from other data sets that have the same name.
COPYTOCOPY TABLESPACE DBA90302.TLA9032A
FROMCOPY DH109003.COPY1.STEP1.COPY4
FROMVOLUME CATALOG
COPYDDN(,COPY2)
Example 6: Identifying an uncataloged image copy data set
The control statement specifies that COPYTOCOPY is to make a local site backup copy, a recovery site primary copy, and a recovery site backup copy from an uncataloged data set, JUKQU2BP.COPY1.STEP1.TP01. The FROMCOPY option identifies this input data set name, and the FROMVOLUME option identifies the volume (SCR03) for the input data set. Use the FROMVOLUME option to distinguish a data set from other data sets that have the same name. The COPYDDN option identifies the data set for the local site backup copy. This data set is to be dynamically allocated according to the specifications of the C2C1_T1 template, which is defined in one of the preceding TEMPLATE control statements. The RECOVERYDDN option identifies the data sets for the recovery site copies. These data sets are to be dynamically allocated according to the specifications of the C2C1_T2 and C2C1_T3 templates, which are defined in the preceding TEMPLATE control statements.
//STEP1 EXEC DSNUPROC,UID='JUKQU2BP.C2C1',
// UTPROC='',
// SYSTEM='SSTR'
//SYSIN DD *
TEMPLATE C2C1_T1
DSN(JUKQU2BP.C2C1.LB.&SN.)
DISP(NEW,CATLG,CATLG)
UNIT(SYSDA)
TEMPLATE C2C1_T2
DSN(JUKQU2BP.C2C1.RP.&SN.)
DISP(NEW,CATLG,CATLG)
UNIT(SYSDA)
TEMPLATE C2C1_T3
DSN(JUKQU2BP.C2C1.RB.&SN.)
DISP(NEW,CATLG,CATLG)
UNIT(SYSDA)
COPYTOCOPY TABLESPACE DBKQBP01.TPKQBP01
FROMCOPY JUKQU2BP.COPY1.STEP1.TP01
FROMVOLUME SCR03
COPYDDN(,C2C1_T1)
RECOVERYDDN(C2C1_T2,C2C1_T3)
/*
Example 7: Processing a list of objects
The following control statement specifies that COPYTOCOPY is to make local site backup copies of the three partitions of table space DBA90402.TPA9042C that are specified by the DSNUM option (partitions 2, 3, and 4). COPYTOCOPY uses the following input copy data sets, as indicated by the FROMLASTFULLCOPY, FROMLASTCOPY, and FROMLASTINCRCOPY options:
- The most recent full image copy for partition 2
- The most recent full image copy or incremental image copy, whichever is most recent, for partition 3
- The most recent incremental image copy for partition 4
The COPYDDN option for each partition indicates the output data sets (COPY2, COPY3, and COPY4).
COPYTOCOPY
TABLESPACE DBA90402.TPA9042C DSNUM 2
FROMLASTFULLCOPY COPYDDN(,COPY2)
TABLESPACE DBA90402.TPA9042C DSNUM 3
FROMLASTCOPY COPYDDN(,COPY3)
TABLESPACE DBA90402.TPA9042C DSNUM 4
FROMLASTINCRCOPY COPYDDN(,COPY4)
Example 8: Using LISTDEF and TEMPLATE switching
The following COPYTOCOPY control statement specifies that the utility is to copy the list of objects that are included in the CPY1 list, which is defined by the LISTDEF control statement. The copies are to be written to the data sets that are defined by the T3 template, which is defined in the TEMPLATE control statement. Additionally, T3 template has defined the LIMIT keyword, that is to switch from T3 template to T4 template if the output data set size is bigger than the specified limit value 5 MB. This template defines the naming convention for the output data sets that are to be dynamically allocated.
The OPTIONS PREVIEW statement before the LISTDEF statement is used to force the CPY1 list contents to be included in the output. For long lists, using this statement is not recommended, because it might cause the output to be too long. The OPTIONS OFF statement ends the PREVIEW mode processing, so that the following TEMPLATE and COPYTOCOPY jobs run normally.
OPTIONS PREVIEW
LISTDEF CPY1 INCLUDE TABLESPACES TABLESPACE DBA906*.T*A906*
INCLUDE INDEXSPACES COPY YES INDEXSPACE ADMF001.I?A906*
OPTIONS OFF
TEMPLATE T4 UNIT(3B0)
DSN(T4.&SN..T&TI..COPY&IC.&LOCREM.)
TEMPLATE T3 UNIT(SYSDA) SPACE CYL
DSN(T3.&SN..T&TI..COPY&IC.&LOCREM.)
LIMIT(5 MB,T4)
COPYTOCOPY LIST CPY1 COPYDDN(T3,T3)
Example 9: Using LISTDEF and TEMPLATE with the CLONE option
The following COPYTOCOPY control statement specifies that the utility is to copy the list of objects that are included in the C2C1_LIST list, which is defined by the LISTDEF control statement. The CLONE option indicates that COPYTOCOPY is to process only image copy data sets that were taken against clone objects.
LISTDEF C2C1_LIST
INCLUDE TABLESPACES TABLESPACE DBKQBS01.TPKQBS01
INCLUDE INDEXSPACES INDEXSPACE DBKQBS01.IPKQBS11
INCLUDE INDEXSPACES INDEXSPACE DBKQBS01.IXKQBS12
INCLUDE TABLESPACES TABLESPACE DBKQBS02.TSKQBS02
INCLUDE INDEXSPACES INDEXSPACE DBKQBS02.IXKQBS21
INCLUDE INDEXSPACES INDEXSPACE DBKQBS02.IXKQBS22
TEMPLATE C2C1_T1
DSN(JUKQU2BS.C2C1.LB.&SN.)
DISP(NEW,CATLG,CATLG)
UNIT(SYSDA)
TEMPLATE C2C1_T2
DSN(JUKQU2BS.C2C1.RP.&SN.)
DISP(NEW,CATLG,CATLG)
UNIT(SYSDA)
TEMPLATE C2C1_T3
DSN(JUKQU2BS.C2C1.RB.&SN.)
DISP(NEW,CATLG,CATLG)
UNIT(SYSDA)
COPYTOCOPY LIST C2C1_LIST
FROMLASTFULLCOPY
COPYDDN(,C2C1_T1)
RECOVERYDDN(C2C1_T2,C2C1_T3)
CLONE