In this topic, we described about the Copy Datasets with detailed example.
IEBCOPY can be used to copy a PDS from one direct access volume to anothervolume totally or partially. If data set name is changed, data set can be copied to its own volume.
If the data set name is not changed, IEBCOPY interprets the copying request provided the SELECT / EXCLUDE statement is not codedas a compress-in-place. If IEBCOPY used to copy a PDSE to a PDSE, either volume to volume or to its own volume, all DDM attributes are copied.
Members copied into a PDS are not physically reordered. Members are copied in the physical order in how they exist in the original data set.
A partitioned data set (DATASET1) is copied from one disk volume to another.
//COPYDS JOB ... //STEP01 EXEC PGM=IEBCOPY //SYSPRINT DD SYSOUT=A //SYSUT1 DD DSNAME=DATASET1,UNIT=disk,VOL=SER=111111, // DISP=SHR //SYSUT2 DD DSNAME=DATASET2,UNIT=disk,VOL=SER=111112, // DISP=(NEW,KEEP),SPACE=(TRK,(5,1,2))
Let’s discuss the example in detail.
- SYSUT1 DD defines a PDSDATASET1 that contains three members (A, B and C).
- SYSUT2 DD defines a new PDSDATASET2 that is to be kept after the copy operation.
- Input and output data sets are identified as SYSUT1 and SYSUT2, the SYSIN data set is not needed.
- The SYSUT1 data set will be copied in full to the SYSUT2 data set.
- After the copy operation is finished, DATASET2 will contain the same members that are in DATASET1.