Example 9: Unload Selected Members, Load, Copy and Merge
In this example, members are selected, excluded, unloaded, loaded, and copied. Processing will occur as follows:
- unload, excluding members
- unload, selecting members
- load and copy to merge members
//COPY JOB ...
//STEP EXEC PGM=IEBCOPY
//SYSPRINT DD SYSOUT=A
//PDS1 DD DSNAME=ACCOUNTA,UNIT=disk,VOL=SER=333333,
// DISP=OLD
//PDS2 DD DSNAME=ACCOUNTB,UNIT=disk,VOL=SER=333333,
// DISP=OLD
//SEQ1 DD DSNAME=SAVAC,UNIT=disk,VOL=SER=333333,
// DISP=(NEW,KEEP),SPACE=(CYL,(5,2))
//SEQ2 DD DSNAME=SAVACB,UNIT=tape,VOL=SER=T01911,
// DISP=(NEW,KEEP),LABEL=(,SL)
//NEWUP DD DSNAME=NEWACC,UNIT=tape,VOL=SER=T01219,
// DISP=OLD,LABEL=(,SL)
//MERGE DD DSNAME=ACCUPDAT,UNIT=disk,VOL=SER=222222,
// DISP=OLD
//SYSUT3 DD DSNAME=TEMP1,VOL=SER=666666,UNIT=disk,
// DISP=(NEW,DELETE),SPACE=(80,(1,1))
//SYSUT4 DD DSNAME=TEMP2,VOL=SER=666666,UNIT=disk,
// DISP=(NEW,DELETE),SPACE=(256,(1,1)),DCB=(KEYLEN=8)
//SYSIN DD *
COPY OUTDD=SEQ1,INDD=PDS1
EXCLUDE MEMBER=(D,C)
COPY OUTDD=SEQ2,INDD=PDS2
SELECT MEMBER=(A,K)
COPY OUTDD=MERGE,INDD=((NEWUP,R),PDS1,PDS2)
EXCLUDE MEMBER=A
/*
The control statements are as follows:
- PDS1 DD defines a partitioned data set called ACCOUNTA that contains six members (A, B, C, D, E, and F).
- PDS2 DD defines a partitioned data set called ACCOUNTB that contains three members (A, K, and L).
- SEQ1 DD defines a new sequential data set called SAVAC.
- SEQ2 DD defines a new sequential data set called SAVACB on a tape volume. The tape has IBM standard labels.
- NEWUP DD defines an old sequential data set called NEWACC that is the unloaded form of a partitioned data set that contains eight members (A, B, C, D, M, N, O, and P). It resides on a tape volume.
- MERGE DD defines a partitioned data set called ACCUPDAT that contains six members (A, B, C, D, Q, and R).
- SYSUT3 and SYSUT4 DD define temporary spill data sets.
- SYSIN DD defines the control data set, which follows in the input stream.
- The first COPY statement indicates the start of the first copy
operation. The OUTDD parameter specifies that SAVAC is the output
data set, and the INNDD parameter specifies that ACCOUNTA is the input
data set. Because SAVAC is a sequential data set, ACCOUNTA will be
unloaded in this copy operation.
The EXCLUDE statement specifies that members D and C are not to be unloaded to SAVAC with the rest of ACCOUNTA.
- The second COPY statement indicates the start of the second copy
operation. The OUTDD parameter specifies that SAVACB is the output
data set, and the INDD parameter specifies that ACCOUNTB is the input
data set. Because SAVACB is a sequential data set, ACCOUNTB will be
unloaded in this copy operation.
The SELECT statement specifies that members A and K are the only members of ACCOUNTB that are to be unloaded to SAVACB.
- The third COPY statement indicates the start of the last copy
operation. The OUTDD parameter specifies that ACCUPDAT is the output
data set. The EXCLUDE statement specifies that member A is excluded
from this copy operation. The three data sets specified in the INDD
parameter will be processed as follows:
- The data set NEWACC is a sequential data set, so it is loaded into ACCUPDAT. Because the replace option is specified, members B, C, and D in NEWACC replace identically named members in ACCUPDAT. The remaining members of NEWACC are also copied to ACCUPDAT, except for A, which is excluded from the copy operation.
- The data set ACCOUNTA is a partitioned data set, so its members are copied to ACCUPDAT. Because replacement is not specified, only members E and F are copied.
- The data set ACCOUNTB is a partitioned data set, so its members are copied to ACCUPDAT. Only members K and L are copied.