|
In this example, members are selected, excluded, and copied from
input partitioned data sets to an output partitioned data set. This
example is designed to illustrate multiple copy operations. Figure 1, Figure 2, and Figure 3 show
the input and output data sets before and after processing.
The example follows:
//COPY JOB ...
//JOBSTEP EXEC PGM=IEBCOPY
//SYSPRINT DD SYSOUT=A
//OUTA DD DSNAME=DATASETA,UNIT=disk,VOL=SER=111113,
// DISP=OLD
//INOUTB DD DSNAME=DATASETB,VOL=SER=111115,UNIT=disk,
// DISP=(OLD,KEEP)
//INOUTC DD DSNAME=DATASETC,VOL=SER=111114,UNIT=disk,
// DISP=(OLD,KEEP)
//INOUTD DD DSNAME=DATASETD,VOL=SER=111116,DISP=OLD,
// UNIT=disk
//INE DD DSNAME=DATASETE,VOL=SER=111117,DISP=OLD,
// UNIT=disk
//SYSUT3 DD UNIT=SYSDA,SPACE=(TRK,(1))
//SYSUT4 DD UNIT=SYSDA,SPACE=(TRK,(1))
//SYSIN DD *
COPY OUTDD=OUTA
INDD=INE
SELECT MEMBER=(MA,MJ)
INDD=INOUTC
EXCLUDE MEMBER=(MM,MN)
COPY OUTDD=INOUTB,INDD=INOUTD
INDD=((INOUTC,R),INOUTB)
COPY OUTDD=INOUTD,INDD=((INOUTB,R))
SELECT MEMBER=MM
/*
The control statements are discussed below:
- OUTA DD defines a partitioned data set, DATASETA, which contains
three members (MA, MB and MD).
- INOUTB DD defines a partitioned data set, DATASETB, which contains
two members (MA and MJ).
- INOUTC DD defines a partitioned data set, DATASETC, which contains
four members (MF, ML, MM and MN).
- INOUTD DD defines a partitioned data set, DATASETD, which contains
two members (MM and MP).
- INE DD defines a partitioned data set, DATASETE, which contains
three members (MA, MJ and MK).
- SYSUT3 and SYSUT4 DD define temporary spill data sets. One track
is allocated for each on a disk volume.
- SYSIN DD defines the control data set, which follows in the input
stream. The data set contains three COPY statements, two SELECT statements,
one EXCLUDE statement, and several INDD statements.
- The first COPY statement indicates the start of a copy operation.
The OUTDD operand specifies DATASETA as the output data set.
The
first INDD statement specifies DATASETE as the first input data set
to be processed. The SELECT statement specifies that members MA and
MJ are to be copied from DATASETE to DATASETA. Processing occurs as
follows:
- Member MA is searched for and found, but is not copied because
the replace option is not specified.
- Member MJ is searched for, found, and copied to DATASETA.
The second INDD statement marks the end of the first
copy step and the beginning of the second copy step within the first
copy operation. It specifies DATASETC as the second input data set
to be processed. Members MF and ML, which are not named on the EXCLUDE
statement, are copied because DATASETA contains neither one of them.
EXCLUDE specifies that members MM and MN are not to be copied from
DATASETC to DATASETA.
- The second COPY statement indicates the start of another copy
operation. The OUTDD parameter specifies DATASETB as the output data
set. The INDD parameter specifies DATASETD as the first input data
set to be processed. Members MP and MM are copied to DATASETB.
The
next INDD statement specifies DATASETC as the second and DATASETB
as the third input data set to be processed. Members MF, ML, MM and
MN are copied from DATASETC. Member MM is copied, although DATASETB
already contains a member MM, because the replace option is specified.
The pointer in DATASETB's directory is changed to point to the
new (copied) member MM. Thus, the space occupied by the replaced member
MM is embedded, unused space. DATASETB is then compressed in place
to remove embedded, unused space. (DATASETB is specified as both the
input and output data sets.)
- The third COPY statement indicates the start of the last copy
operation. The OUTDD parameter specifies DATASETD as the output data
set. The INDD parameter specifies DATASETB as the input data set.
SELECT
specifies that member MM is to be copied from DATASETB to DATASETD.
Since the replace option is specified on the data set level, member
MM is copied and replaces DATASETDs member MM.
Figure 1. Multiple Copy Operations/Copy Steps within
a Job Step (Part 1 of 3)
Figure 2. Multiple Copy
Operations/Copy Steps within a Job Step (Part 2 of 3)
Figure 3. Multiple Copy
Operations/Copy Steps within a Job Step (Part 3 of 3)
|