In this example, members are copied from three input partitioned
data sets (DATASET1, DATASET5, and DATASET6) to an existing output
partitioned data set (DATASET2). The sequence in which the control
statements occur controls the manner and sequence in which partitioned
data sets are processed. Figure 1 shows the input and output
data sets before and after processing.
Figure 1. Copying from Three Input
Partitioned Data Sets
The example follows:
//COPY JOB ...
//JOBSTEP EXEC PGM=IEBCOPY
//SYSPRINT DD SYSOUT=A
//IN1 DD DSNAME=DATASET1,UNIT=disk,VOL=SER=111112,
// DISP=SHR
//IN5 DD DSNAME=DATASET5,UNIT=disk,VOL=SER=111114,
// DISP=OLD
//OUT2 DD DSNAME=DATASET2,UNIT=disk,VOL=SER=111115,
// DISP=(OLD,KEEP)
//IN6 DD DSNAME=DATASET6,UNIT=disk,VOL=SER=111117,
// DISP=(OLD,DELETE)
//SYSUT3 DD UNIT=SYSDA,SPACE=(TRK,(1))
//SYSIN DD *
COPYOPER COPY OUTDD=OUT2
INDD=IN1
INDD=IN6
INDD=IN5
/*
The control statements are discussed below:
- IN1 DD defines a partitioned data set (DATASET1). This data set
contains three members (A, B, and F) in fixed format with a logical
record length of 80 bytes and a block size of 80 bytes.
- IN5 DD defines a partitioned data set (DATASET5). This data set
contains two members (A and C) in fixed blocked format with a logical
record length of 80 bytes and a block size of 160 bytes.
- OUT2 DD defines a partitioned data set (DATASET2). This data set
contains two members (C and E) in fixed-block format. The members
have a logical record length of 80 bytes and a block size of 240 bytes.
- IN6 DD defines a partitioned data set (DATASET6). This data set
contains three members (B, C, and D) in fixed-block format with a
logical record length of 80 bytes and a block size of 400 bytes. This
data set is to be deleted when processing is completed.
- SYSUT3 defines a temporary spill data set.
- SYSIN DD defines the control data set, which follows in the input
stream. The data set contains a COPY statement and three INDD statements.
- COPY indicates the start of the copy operation. The OUTDD parameter
specifies DATASET2 as the output data set.
- The first INDD statement specifies DATASET1 as the first input
data set to be processed. All members (A, B and F) are copied to DATASET2.
- The second INDD statement specifies DATASET6 as the second input
data set to be processed. Processing occurs as follows:
- Since replacement is not specified, members B and C, which already
exist in DATASET2, are not copied to DATASET2.
- Member D is copied to DATASET2.
- All members in DATASET6 are lost when the data set is deleted.
- The third INDD statement specifies DATASET5 as the third input
data set to be processed. No members are copied to DATASET2 because
all exist in DATASET2.