Sample COPY control statements
Use the sample control statements as models for developing your own COPY control statements.
In some cases, you might run a COPY utility job more than once. To avoid duplicate image copy data sets, a DSN qualifier is used in the following examples.
Example 1: Making a full image copy
The following control statement specifies that the COPY utility is to make a full image copy of table space DSN8D12A.DSN8S12E. The copy is to be written to the data set that is defined by the SYSCOPY DD statement in the JCL; SYSCOPY is the default.
//STEP1 EXEC DSNUPROC,UID='IUJMU111.COPYTS',
// UTPROC='',
// SYSTEM='DSN'
//SYSCOPY DD DSN=COPY001F.IFDY01,UNIT=SYSDA,VOL=SER=CPY01I,
// SPACE=(CYL,(15,1)),DISP=(NEW,CATLG,CATLG)
//SYSIN DD *
COPY TABLESPACE DSN8D12A.DSN8S12E
/*
Instead of defining the data sets in the JCL, you can use templates. In the following example, the preceding job is modified to use a template. In this example, the name of the template is LOCALDDN. The LOCALDDN template is identified in the COPY statement by the COPYDDN option.
//STEP1 EXEC DSNUPROC,UID='IUJMU111.COPYTS',
// UTPROC='',
// SYSTEM='DSN'
//SYSIN DD *
TEMPLATE LOCALDDN UNIT SYSDA DSN(COPY001F.IFDY01)
SPACE(15,1) CYL DISP(NEW,CATLG,CATLG)
COPY TABLESPACE DSN8D81A.DSN8S81E COPYDDN(LOCALDDN)
/*
Example 2: Making full image copies for local site and recovery site
The following COPY control statement specifies that COPY is to make primary and backup full image copies of table space DSN8D12P.DSN8S12C at both the local site and the recovery site. The COPYDDN option specifies the output data sets for the local site, and the RECOVERYDDN option specifies the output data sets for the recovery site. The PARALLEL option indicates that up to 2 objects are to be processed in parallel.
The OPTIONS statement at the beginning indicates that if COPY encounters any errors (return code 8) while making the requested copies, Db2 ignores that particular item. COPY skips that item and moves on to the next item. For example, if Db2 encounters an error copying the specified data set to the COPY1 data set, Db2 ignores the error and tries to copy the table space to the COPY2 data set.
OPTIONS EVENT(ITEMERROR,SKIP)
COPY TABLESPACE DSN8D81P.DSN8S81C
COPYDDN(COPY1,COPY2)
RECOVERYDDN(COPY3,COPY4)
PARALLEL(2)
Example 3: Making full image copies of a list of objects
The control statement below specifies that COPY is to make local and recovery full image copies (both primary and backup) of the following objects:
- Table space DSN8D12A.DSN8S12D, and its indexes:
- DSN8C10.XDEPT1
- DSN8C10.XDEPT2
- DSN8C10.XDEPT3
- Table space DSN8D12A.DSN8S12E, and its indexes:
- DSN8710.XEMP1
- DSN8710.XEMP2
These copies are to be written to the data sets that are identified by the COPYDDN and RECOVERYDDN options for each object. The COPYDDN option specifies the data sets for the copies at the local site, and the RECOVERYDDN option specifies the data sets for the copies at the recovery site. The first parameter of each of these options specifies the data set for the primary copy, and the second parameter specifies the data set for the backup copy. For example, the primary copy of table space DSN8D81A.DSN8S81D at the recovery site is to be written to the data set that is identified by the COPY3 DD statement.
PARALLEL(4) indicates that up to four of these objects can be processed in parallel. As the COPY job of an object completes, the next object in the list begins processing in parallel until all of the objects have been processed.
SHRLEVEL REFERENCE specifies that no updates are allowed during the COPY job. This option is the default and is recommended to ensure the integrity of the data in the image copy.
//STEP1 EXEC DSNUPROC,UID='IUJMU111.COPYTS',
// UTPROC='',
// SYSTEM='DSN'
//COPY1 DD DSN=C81A.S20001.D2003142.T155241.LP,
// SPACE=(CYL,(15,1)),DISP=(NEW,CATLG,CATLG)
//COPY2 DD DSN=C81A.S20001.D2003142.T155241.LB,
// SPACE=(CYL,(15,1)),DISP=(NEW,CATLG,CATLG)
//COPY3 DD DSN=C81A.S20001.D2003142.T155241.RP,
// SPACE=(CYL,(15,1)),DISP=(NEW,CATLG,CATLG)
//COPY4 DD DSN=C81A.S20001.D2003142.T155241.RB,
// SPACE=(CYL,(15,1)),DISP=(NEW,CATLG,CATLG)
//COPY5 DD DSN=C81A.S20002.D2003142.T155241.LP,
// SPACE=(CYL,(15,1)),DISP=(NEW,CATLG,CATLG)
//COPY6 DD DSN=C81A.S20002.D2003142.T155241.LB,
// SPACE=(CYL,(15,1)),DISP=(NEW,CATLG,CATLG)
//COPY7 DD DSN=C81A.S20002.D2003142.T155241.RP,
// SPACE=(CYL,(15,1)),DISP=(NEW,CATLG,CATLG)
//COPY8 DD DSN=C81A.S20002.D2003142.T155241.RB,
// SPACE=(CYL,(15,1)),DISP=(NEW,CATLG,CATLG)
//COPY1 DD DSN=C81A.S20001.D2003142.T155241.LP,
// SPACE=(CYL,(15,1)),DISP=(NEW,CATLG,CATLG)
//COPY2 DD DSN=C81A.S20001.D2003142.T155241.LB,
// SPACE=(CYL,(15,1)),DISP=(NEW,CATLG,CATLG)
//COPY3 DD DSN=C81A.S20001.D2003142.T155241.RP,
// SPACE=(CYL,(15,1)),DISP=(NEW,CATLG,CATLG)
//COPY4 DD DSN=C81A.S20001.D2003142.T155241.RB,
// SPACE=(CYL,(15,1)),DISP=(NEW,CATLG,CATLG)
//COPY5 DD DSN=C81A.S20002.D2003142.T155241.LP,
// SPACE=(CYL,(15,1)),DISP=(NEW,CATLG,CATLG)
//COPY6 DD DSN=C81A.S20002.D2003142.T155241.LB,
// SPACE=(CYL,(15,1)),DISP=(NEW,CATLG,CATLG)
//COPY7 DD DSN=C81A.S20002.D2003142.T155241.RP,
// SPACE=(CYL,(15,1)),DISP=(NEW,CATLG,CATLG)
//COPY8 DD DSN=C81A.S20002.D2003142.T155241.RB,
// SPACE=(CYL,(15,1)),DISP=(NEW,CATLG,CATLG)
//COPY9 DD DSN=C81A.S20003.D2003142.T155241.LP,
// SPACE=(CYL,(15,1)),DISP=(NEW,CATLG,CATLG)
//COPY10 DD DSN=C81A.S20003.D2003142.T155241.LB,
// SPACE=(CYL,(15,1)),DISP=(NEW,CATLG,CATLG)
//COPY11 DD DSN=C81A.S20003.D2003142.T155241.RP,
// SPACE=(CYL,(15,1)),DISP=(NEW,CATLG,CATLG)
//COPY12 DD DSN=C81A.S00003.D2003142.T155241.RB,
// SPACE=(CYL,(15,1)),DISP=(NEW,CATLG,CATLG)
//COPY13 DD DSN=C81A.S00004.D2003142.T155241.LP,
// SPACE=(CYL,(15,1)),DISP=(NEW,CATLG,CATLG)
//COPY14 DD DSN=C81A.S00004.D2003142.T155241.LB,
// SPACE=(CYL,(15,1)),DISP=(NEW,CATLG,CATLG)
//COPY15 DD DSN=C81A.S00004.D2003142.T155241.RP,
// SPACE=(CYL,(15,1)),DISP=(NEW,CATLG,CATLG)
//COPY16 DD DSN=C81A.S00004.D2003142.T155241.RB,
// SPACE=(CYL,(15,1)),DISP=(NEW,CATLG,CATLG)
//COPY17 DD DSN=C81A.S00005.D2003142.T155241.LP,
// SPACE=(CYL,(15,1)),DISP=(NEW,CATLG,CATLG)
//COPY18 DD DSN=C81A.S00005.D2003142.T155241.LB,
// SPACE=(CYL,(15,1)),DISP=(NEW,CATLG,CATLG)
//COPY19 DD DSN=C81A.S00005.D2003142.T155241.RP,
// SPACE=(CYL,(15,1)),DISP=(NEW,CATLG,CATLG)
//COPY20 DD DSN=C81A.S00005.D2003142.T155241.RB,
// SPACE=(CYL,(15,1)),DISP=(NEW,CATLG,CATLG)
//COPY21 DD DSN=C81A.S00006.D2003142.T155241.LP,
// SPACE=(CYL,(15,1)),DISP=(NEW,CATLG,CATLG)
//COPY22 DD DSN=C81A.S00006.D2003142.T155241.LB,
// SPACE=(CYL,(15,1)),DISP=(NEW,CATLG,CATLG)
//COPY23 DD DSN=C81A.S00006.D2003142.T155241.RP,
// SPACE=(CYL,(15,1)),DISP=(NEW,CATLG,CATLG)
//COPY24 DD DSN=C81A.S00006.D2003142.T155241.RB,
// SPACE=(CYL,(15,1)),DISP=(NEW,CATLG,CATLG)
//COPY25 DD DSN=C81A.S00007.D2003142.T155241.LP,
// SPACE=(CYL,(15,1)),DISP=(NEW,CATLG,CATLG)
//COPY26 DD DSN=C81A.S00007.D2003142.T155241.LB,
// SPACE=(CYL,(15,1)),DISP=(NEW,CATLG,CATLG)
//COPY27 DD DSN=C81A.S00007.D2003142.T155241.RP,
// SPACE=(CYL,(15,1)),DISP=(NEW,CATLG,CATLG)
//COPY28 DD DSN=C81A.S00007.D2003142.T155241.RB,
// SPACE=(CYL,(15,1)),DISP=(NEW,CATLG,CATLG)
//SYSIN DD *
COPY
TABLESPACE DSN8D12A.DSN8S12D
COPYDDN (COPY1,COPY2)
RECOVERYDDN (COPY3,COPY4)
INDEX DSN8C10.XDEPT1
COPYDDN (COPY5,COPY6)
RECOVERYDDN (COPY7,COPY8)
INDEX DSN8C10.XDEPT2
COPYDDN (COPY9,COPY10)
RECOVERYDDN (COPY11,COPY12)
INDEX DSN8C10.XDEPT3
COPYDDN (COPY13,COPY14)
RECOVERYDDN (COPY15,COPY16)
TABLESPACE DSN8D12A.DSN8S12E
COPYDDN (COPY17,COPY18)
RECOVERYDDN (COPY19,COPY20)
INDEX DSN8C10.XEMP1
COPYDDN (COPY21,COPY22)
RECOVERYDDN (COPY23,COPY24)
INDEX DSN8C10.XEMP2
COPYDDN (COPY25,COPY26)
RECOVERYDDN (COPY27,COPY28)
PARALLEL(4)
SHRLEVEL REFERENCE
/*
You can also write this COPY job so that it uses lists and templates, as shown below. In this example, the name of the template is T1. Note that this TEMPLATE statement does not contain any space specifications for the dynamically allocated data sets. Instead, Db2 determines the space requirements. The T1 template is identified in the COPY statement by the COPYDDN and RECOVERYDDN options. The name of the list is COPYLIST. This list is identified in the COPY control statement by the LIST option.
//STEP1 EXEC DSNUPROC,UID='IUJMU111.COPYTS',
// UTPROC='',
// SYSTEM='DSN'
//SYSIN DD *
TEMPLATE T2 UNIT(SYSDA) SPACE CYL
DSN(T2.&SN..T&TI..COPY&IC.&LOCREM.)
TEMPLATE T1 UNIT(SYSDA) SPACE CYL
DSN(T1.&SN..T&TI..COPY&IC.&LOCREM.)
LIMIT(5 MB,T2)
LISTDEF COPYLIST
INCLUDE TABLESPACE DSN8D81A.DSN8S81D
INCLUDE INDEX DSN8810.XDEPT1
INCLUDE INDEX DSN8810.XDEPT2
INCLUDE INDEX DSN8810.XDEPT3
INCLUDE TABLESPACE DSN8D81A.DSN8S81E
INCLUDE INDEX DSN8810.XEMP1
INCLUDE INDEX DSN8810.XEMP2
COPY LIST COPYLIST COPYDDN(T1,T1)
RECOVERYDDN(T1,T1)
PARALLEL(4) SHRLEVEL REFERENCE
/*
Example 4: Using template switching
The following TEMPLATE control statement assumes that tables space SMALL.TS occupies 10 cylinders and table space LARGE.TS occupies 100 cylinders. Both COPY statements use the SMALLTP template which specifies a limit of 20 cylinders. Table space SMALL.TS is smaller than this limit so no switching is performed. The output data set for table space SMALL.TS will be allocated on UNIT=SYSALLDA. Table space LARGE.TS is larger than this limit so the template is switched to the LARGETP template. The output data set for table space LARGE.TS will be allocated on UNIT=TAPE.
TEMPLATE LARGETP DSN &DB..&TS..D&DA..T&TI. UNIT=TAPE
TEMPLATE SMALLTP DSN &DB..&TS..D&DA..T&TI. UNIT=SYSALLDA LIMIT( 20 CYL, LARGETP )
COPY TABLESPACE SMALL.TS COPYDDN( SMALLTP )
COPY TABLESPACE LARGE.TS COPYDDN( SMALLTP )
Note that the DSN option of the TEMPLATE statement identifies the names of the data sets to which the copies are to be written.
Each of the preceding COPY jobs create a point of consistency for the table spaces and their indexes. You can subsequently use the RECOVER utility with the TOLOGPOINT option to recover all of these objects.
Example 5: Making full image copies of a list of objects in parallel on tape
The following COPY control statement specifies that COPY is to make image copies of the specified table spaces and their associated index spaces in parallel and stack the copies on different tape devices.
The PARALLEL 2 option specifies that up to two objects can be processed in parallel. The TAPEUNITS 2 option specifies that up to two tape devices can be dynamically allocated at one time. The COPYDDN option for each object specifies the data set that is to be used for the local image copy. In this example, all of these data sets are dynamically allocated and defined by templates. For example, table space DSN8D81A.DSN8S81D is copied into a data set that is defined by the A1 template.
The TEMPLATE utility control statements define the templates A1 and A2.
//COPY2A EXEC DSNUPROC,SYSTEM=DSN
//SYSIN DD *
TEMPLATE A1 DSN(&DB..&SP..COPY1) UNIT CART STACK YES
TEMPLATE A2 DSN(&DB..&SP..COPY2) UNIT CART STACK YES
COPY PARALLEL 2 TAPEUNITS 2
TABLESPACE DSN8D81A.DSN8S81D COPYDDN(A1)
INDEXSPACE DSN8810.XDEPT COPYDDN(A1)
TABLESPACE DSN8D81A.DSN8S81E COPYDDN(A2)
INDEXSPACE DSN8810.YDEPT COPYDDN(A2)
Although use of templates is recommended, you can also define the output data sets by coding JCL DD statements, as in the following example. This COPY control statement also specifies a list of objects to be processed in parallel, but in this case, the data sets are defined by DD statements. In each DD statement, notice the parameters for the VOLUME option. These values show that the data sets are defined on three different tape devices as follows:
- The first tape device contains data sets that are defined by DD statements DD1 and DD4. (For DD4, the VOLUME option has a value of *.DD1 for the REF parameter.)
- A second tape device contains data sets that are defined by DD statements DD2 and DD3. (For DD3, the VOLUME option has a value of *.DD3 for the REF parameter.)
- A third tape device contains the data set that is defined by DD statement DD5.
The following table spaces are to be processed in parallel on two different tape devices:
- DSN8D81A.DSN8S81D on the device that is defined by the DD1 DD statement and the device that is defined by the DD5 DD statement
- DSN8D81A.DSN8S81E on the device that is defined by the DD2 DD statement
Copying of the following tables spaces must wait until processing has completed for DSN8D81A.DSN8S81D and DSN8D81A.DSN8S81E:
- DSN8D81A.DSN8S81F on the device that is defined by the DD2 DD statement after DSN8D81A.DSN8S81E completes processing
- DSN8D81A.DSN8S81G on the device that is defined by the DD1 DD statement after DSN8D81A.DSN8S81D completes processing
//COPY1A EXEC DSNUPROC,SYSTEM=DSN
//DD1 DD DSN=DB1.TS1.CLP,
// DISP=(NEW,CATLG,CATLG),
// UNIT=TAPE,LABEL=(1,SL),
// VOLUME=(,RETAIN)
//DD2 DD DSN=DB2.TS2.CLP,
// DISP=(NEW,CATLG,CATLG),
// UNIT=TAPE,LABEL=(1,SL),
// VOLUME=(,RETAIN)
//DD3 DD DSN=DB3.TS3.CLB.BACKUP,
// DISP=(NEW,CATLG,CATLG),
// UNIT=TAPE,LABEL=(2,SL),
// VOLUME=(,RETAIN,REF=*.DD2)
//DD4 DD DSN=DB4.TS4.CLB.BACKUP,
// DISP=(NEW,CATLG,CATLG),
// UNIT=TAPE,LABEL=(2,SL),
// VOLUME=(,RETAIN,REF=*.DD1)
//DD5 DD DSN=DB1.TS1.CLB.BACKUP,
// DISP=(NEW,CATLG,CATLG),
// UNIT=TAPE,LABEL=(1,SL),
// VOLUME=(,RETAIN)
COPY PARALLEL 2 TAPEUNITS 3
TABLESPACE DSN8D81A.DSN8S81D COPYDDN(DD1,DD5)
TABLESPACE DSN8D81A.DSN8S81E COPYDDN(DD2)
TABLESPACE DSN8D81A.DSN8S81F COPYDDN(DD3)
TABLESPACE DSN8D81A.DSN8S81G COPYDDN(DD4)
Example 6: Using both JCL-defined and template-defined data sets to copy a list of objects on tape
This example uses both JCL DD statements and utility templates to define four data sets for the image copies. The JCL defines two data sets (DB1.TS1.CLP and Db2.TS2.CLB.BACKUP), and the TEMPLATE utility control statements define two data sets that are to be dynamically allocated (&DB..&SP..COPY1 and &DB..&SP..COPY2).
The COPYDDN options in the COPY control statement specify the data sets that are to be used for the local primary and backup image copies of the specified table spaces. For example, the primary copy of table space DSN8D81A.DSN8S71D is to be written to the data set that is defined by the DD1 DD statement (DB1.TS1.CLP), and the primary copy of table space DSN8D81A.DSN8S71E is to be written to the data set that is defined by the A1 template (&DB..&SP..COPY1).
Four tape devices are allocated for this COPY job: the JCL allocates two tape drives, and the TAPEUNITS 2 option in the COPY statement indicates that two tape devices are to be dynamically allocated. Note that the TAPEUNITS option applies only to those tape devices that are dynamically allocated by the TEMPLATE statement.
//COPY1D EXEC DSNUPROC,SYSTEM=DSN
//DD1 DD DSN=DB1.TS1.CLP,
// DISP=(,CATLG),
// UNIT=3490,LABEL=(1,SL)
// VOLUME=(,RETAIN)
//DD2 DD DSN=DB2.TS2.CLB.BACKUP,
// DISP=(,CATLG),
// UNIT=3490,LABEL=(2,SL)
// VOLUME=(,RETAIN)
//SYSIN DD *
TEMPLATE A1 DSN(&DB..&SN..COPY1) UNIT CART STACK YES
TEMPLATE A2 DSN(&DB..&SN..COPY2) UNIT CART STACK YES
COPY PARALLEL 2 TAPEUNITS 2
TABLESPACE DSN8D81A.DSN8S81D COPYDDN(DD1,DD2)
TABLESPACE DSN8D81A.DSN8S81E COPYDDN(A1,A2)
Example 7: Using LISTDEF to define a list of objects to copy in parallel to tape
The following example uses the LISTDEF utility to define a list of objects to be copied in parallel to different tape sources. The COPY control statement specifies that the table spaces that are included in the PAYROLL list are to copied. (The PAYROLL list is defined by the LISTDEF control statement.) The TEMPLATE control statements define two output data sets, one for the local primary copy (&DB..©..LOCAL) and one for the recovery primary copy (&DB..©..REMOTE).
//COPY3A EXEC DSNUPROC,SYSTEM=DSN
//SYSIN DD *
LISTDEF PAYROLL INCLUDE TABLESPACES TABLESPACE DBPAYROLL.*
TEMPLATE LOCAL DSN(&DB..©..LOCAL) (+1) UNIT CART STACK YES
TEMPLATE REMOTE DSN(&DB..©..REMOTE) (+1) UNIT CART STACK YES
COPY LIST PAYROLL PARALLEL(10) TAPEUNITS(8)
COPYDDN(LOCAL) RECOVERYDDN(REMOTE)
In the preceding example, the utility determines the number of tape streams to use by dividing the value for TAPEUNITS (8) by the number of output data sets (2) for a total of 4 in this example. For each tape stream, the utility attaches one subtask. The list of objects is sorted by size and processed in descending order. The first subtask to finish processes the next object in the list. In this example, the PARALLEL(10) option limits the number of objects to be processed in parallel to 10 and attaches four subtasks. Each subtask copies the objects in the list in parallel to two tape drives, one for the primary and one for the recovery output data sets.
Example 8: Making incremental copies with updates allowed
The FULL NO option in the following COPY control statement specifies that COPY is to make incremental image copies of any specified objects. In this case, the objects to be copied are those objects that are included in the NAME1 list, as indicated by the LIST option. The preceding LISTDEF utility control statement defines the NAME1 list to include index space DSN8D81A.XEMP1 and table space DSN8D81A.DSN8S81D. Although one of the objects to be copied is an index space and COPY does not take incremental image copies of index spaces, the job does not fail; COPY takes a full image copy of the index space instead. However, if a COPY FULL NO statement identifies only an index that is not part of a list, the COPY job fails.
All specified copies (local primary and backup copies and remote primary and backup copies) are written to data sets that are dynamically allocated according to the specifications of the COPYDS template. This template is defined in the preceding TEMPLATE utility control statement.
The SHRLEVEL CHANGE option in the following COPY control statement specifies that updates can be made during the COPY job.
TEMPLATE COPYDS DSN &US.2.&SN..&LR.&PB..D&DATE.
LISTDEF NAME1 INCLUDE INDEXSPACE DSN8D81A.XEMP1
INCLUDE TABLESPACE DSN8D81A.DSN8S81D
COPY LIST NAME1 COPYDDN(COPYDS, COPYDS) RECOVERYDDN(COPYDS,COPYDS)
FULL NO SHRLEVEL CHANGE
Example 9: Making a conditional image copy
The CHANGELIMIT(5) option in the following control statement specifies the following conditions for making an image copy of table space DSN8D81P.DSN8S81C:
- Take a full image copy of the table space if the percentage of changed pages is equal to or greater than 5%.
- Take an incremental image copy of the table space if the percentage of changed pages is greater than 0 and less than 5%.
- Do not take an image copy if no pages have changed.
COPY TABLESPACE DSN8D12P.DSN8S12C CHANGELIMIT(5)
Example 10: Reporting image copy information for a table space
The REPORTONLY option in the following control statement specifies that image copy information is to be displayed only; no image copies are to be made. The CHANGELIMIT(10,40) option specifies that the following information is to be displayed:
- Recommendation that a full image copy be made if the percentage of changed pages is equal to or greater than 40%.
- Recommendation that an incremental image copy be made if the percentage of changed pages is greater than 10% and less than 40%.
- Recommendation that no image copy be made if the percentage of changed pages is 10% or less.
COPY TABLESPACE DSN8D12P.DSN8S12C CHANGELIMIT(10,40) REPORTONLY
Example 11: Invoking DFSMSdss concurrent copy
The CONCURRENT option in the following COPY control statement specifies that DFSMSdss concurrent copy is to make a full image copy of the objects in the COPYLIST list (table space DSN8D81A.DSN8S81D and table space DSN8D81A.DSN8S81P). The COPYDDN option indicates that the copy is to be written to the data set that is defined by the SYSCOPY1 template. The DSSPRINT DD statement specifies the data set for message output.
//COPY EXEC DSNUPROC,SYSTEM=DSN
//SYSPRINT DD DSN=COPY1.PRINT1,DISP=(NEW,CATLG,CATLG),
// SPACE=(4000,(20,20),,,ROUND),UNIT=SYSDA,VOL=SER=DB2CC5
//DSSPRINT DD DSN=COPY1.PRINT2,DISP=(NEW,CATLG,CATLG),
// SPACE=(4000,(20,20),,,ROUND),UNIT=SYSDA,VOL=SER=DB2CC5
//SYSIN DD *
TEMPLATE SYSCOPY1 DSN &DB..&TS..COPY&IC.&LR.&PB..D&DATE..T&TIME.
UNIT(SYSDA) DISP (MOD,CATLG,CATLG)
LISTDEF COPYLIST INCLUDE TABLESPACE DSN8D81A.DSN8S81D
INCLUDE TABLESPACE DSN8D81A.DSN8S81P
COPY LIST COPYLIST
COPYDDN (SYSCOPY1)
CONCURRENT
Example 12: Invoking DFSMSdss concurrent copy and using a filter data set
The control statement specifies that DFSMSdss concurrent copy is to make full image copies of the objects in the TSLIST list (table spaces TS1, TS2, and TS3). The FILTERDDN option specifies that COPY is to use the filter data set that is defined by the FILT template. All output is sent to the SYSCOPY data set, as indicated by the COPYDDN(SYSCOPY) option. SYSCOPY is the default. This data set is defined in the preceding TEMPLATE control statement.
LISTDEF TSLIST
INCLUDE TABLESPACE TS1
INCLUDE TABLESPACE TS2
INCLUDE TABLESPACE TS3
TEMPLATE SYSCOPY DSN &DB..&TS..COPY&IC.&LR.&PB..D&DATE..T&TIME.
UNIT(SYSDA) DISP (MOD,CATLG,CATLG)
TEMPLATE FILT DSN FILT.TEST1.&SN..D&DATE.
UNIT(SYSDA) DISP (MOD,CATLG,DELETE)
COPY LIST TSLIST
FILTERDDN(FILT)
COPYDDN(SYSCOPY)
CONCURRENT
SHRLEVEL REFERENCE
Example 13: Copying LOB table spaces together with related objects
Assume that table space TPIQUD01 is a base table space and that table spaces TLIQUDA1, TLIQUDA2, TLIQUDA3, and TLIQUDA4 are LOB table spaces. The control statement specifies that COPY is to take the following actions:
- Take a full image copy of each specified table space if the percentage of changed pages is equal to or greater than the highest decimal percentage value for the CHANGELIMIT option for that table space. For example, if the percentage of changed pages for table space TPIQUD01 is equal to or greater than 6.7%, COPY is to take a full image copy.
- Take an incremental image copy of each specified table space if the percentage of changed pages is in the range between the specified decimal percentage values for the CHANGELIMIT option for that table space. For example, if the percentage of changed pages for table space TLIQUDA1 is greater than 7.9% and less than 25.3%, COPY is to take an incremental image copy.
- Do not take an image copy of each specified table space if the percentage of changed pages is equal to or less than the lowest decimal percentage value for the CHANGELIMIT option for that table space. For example, if the percentage of changed pages for table space TLIQUDA2 is equal to or less than 2.2%, COPY is not to take an incremental image copy.
- Take full image copies of index spaces IPIQUD01, IXIQUD02, IUIQUD03, IXIQUDA1, IXIQUDA2, IXIQUDA3, and IXIQUDA4.
COPY
TABLESPACE DBIQUD01.TPIQUD01 DSNUM ALL CHANGELIMIT(3.3,6.7)
COPYDDN(COPYTB1)
TABLESPACE DBIQUD01.TLIQUDA1 DSNUM ALL CHANGELIMIT(7.9,25.3)
COPYDDN(COPYTA1)
TABLESPACE DBIQUD01.TLIQUDA2 DSNUM ALL CHANGELIMIT(2.2,4.3)
COPYDDN(COPYTA2)
TABLESPACE DBIQUD01.TLIQUDA3 DSNUM ALL CHANGELIMIT(1.2,9.3)
COPYDDN(COPYTA3)
TABLESPACE DBIQUD01.TLIQUDA4 DSNUM ALL CHANGELIMIT(2.2,4.0)
COPYDDN(COPYTA4)
INDEXSPACE DBIQUD01.IPIQUD01 DSNUM ALL
COPYDDN(COPYIX1)
INDEXSPACE DBIQUD01.IXIQUD02 DSNUM ALL
COPYDDN(COPYIX2)
INDEXSPACE DBIQUD01.IUIQUD03 DSNUM ALL
COPYDDN(COPYIX3)
INDEXSPACE DBIQUD01.IXIQUDA1 DSNUM ALL
COPYDDN(COPYIXA1)
INDEXSPACE DBIQUD01.IXIQUDA2 DSNUM ALL
COPYDDN(COPYIXA2)
INDEXSPACE DBIQUD01.IXIQUDA3 DSNUM ALL
COPYDDN(COPYIXA3)
INDEXSPACE DBIQUD01.IXIQUDA4 DSNUM ALL
COPYDDN(COPYIXA4)
SHRLEVEL REFERENCE
Example 14: Using GDGs to make a full image copy
The following control statement specifies that the COPY utility is to make a full image copy of table space DBLT2501.TPLT2501. The local copies are to be written to data sets that are dynamically allocated according to the COPYTEM1 template. The remote copies are to be written to data sets that are dynamically allocated according to the COPYTEM2 template. For both of these templates, the DSN option indicates the name of generation data group JULTU225 and the generation number of +1. (If a GDG base does not already exist, Db2 creates one.) Both of these output data sets are to be modeled after the JULTU255.MODEL data set (as indicated by the MODELDCB option in the TEMPLATE statements).
//***********************************************************
//* COMMENT: MAKE A FULL IMAGE COPY OF THE TABLESPACE.
//* USE A TEMPLATE FOR THE GDG.
//***********************************************************
//STEP2 EXEC DSNUPROC,UID='JULTU225.COPY',
// UTPROC='',
// SYSTEM='SSTR'
//SYSIN DD *
TEMPLATE COPYTEM1
UNIT SYSDA
DSN 'JULTU225.GDG.LOCAL.&PB.(+1)'
MODELDCB JULTU225.MODEL
TEMPLATE COPYTEM2
UNIT SYSDA
DSN 'JULTU225.GDG.REMOTE.&PB.(+1)'
MODELDCB JULTU225.MODEL
COPY TABLESPACE DBLT2501.TPLT2501
FULL YES
COPYDDN (COPYTEM1,COPYTEM1)
RECOVERYDDN (COPYTEM2,COPYTEM2)
SHRLEVEL REFERENCE
Example 15: Copying updated table space data
The following control statement indicates that COPY is to copy only the objects that have been updated. SCOPE PENDING indicates that you want to copy only those objects in COPY-pending or informational COPY-pending status.
COPY SHRLEVEL REFERENCE
TABLESPACE DBIQUD01.TPIQUD01 DSNUM ALL CHANGELIMIT(3.3,6.7)
COPYDDN(COPYTB1)
TABLESPACE DBIQUD01.TLIQUDA1 DSNUM ALL CHANGELIMIT(7.9,25.3)
COPYDDN(COPYTA1)
TABLESPACE DBIQUD01.TLIQUDA2 DSNUM ALL CHANGELIMIT(2.2,4.3)
COPYDDN(COPYTA2)
TABLESPACE DBIQUD01.TLIQUDA3 DSNUM ALL CHANGELIMIT(1.2,9.3)
COPYDDN(COPYTA3)
TABLESPACE DBIQUD01.TLIQUDA4 DSNUM ALL CHANGELIMIT(2.2,4.0)
COPYDDN(COPYTA4)
INDEXSPACE DBIQUD01.IPIQUD01 DSNUM ALL
COPYDDN(COPYIX1)PARALLEL(4)
SCOPE PENDING
/*
Example 16: Copying clone table data
The following control statement indicates that COPY is to copy only clone table data in the specified table spaces or indexes.
COPY SHRLEVEL REFERENCE CLONE
TABLESPACE DBIQUD01.TPIQUD01 DSNUM ALL CHANGELIMIT(3.3,6.7)
COPYDDN(COPYTB1)
TABLESPACE DBIQUD01.TLIQUDA1 DSNUM ALL CHANGELIMIT(7.9,25.3)
COPYDDN(COPYTA1)
TABLESPACE DBIQUD01.TLIQUDA2 DSNUM ALL CHANGELIMIT(2.2,4.3)
COPYDDN(COPYTA2)
TABLESPACE DBIQUD01.TLIQUDA3 DSNUM ALL CHANGELIMIT(1.2,9.3)
COPYDDN(COPYTA3)
TABLESPACE DBIQUD01.TLIQUDA4 DSNUM ALL CHANGELIMIT(2.2,4.0)
COPYDDN(COPYTA4)
INDEXSPACE DBIQUD01.IPIQUD01 DSNUM ALL
COPYDDN(COPYIX1)