Summary -
In this topic, we described about the Excluding Members from a Copy with detailed example.
IEBCOPY can be used to exclude specified members during copy, unload and load. Members from one or more input data sets can be excluded from a copy, unload, or load operation.
The excluded member is searched for on every input data set in the copy, unloads, or load operation and is omitted. Members are excluded from the input data sets entitled on an INDD statement that precedes the EXCLUDE statement.
A maximum of eight characters can be allowed for the member or alias name on a copy operation. EXCLUDE is not allowed for COPYGRP or for COPYGROUP except the below scenario.
When using COPYGROUP, if SELECT MEMBER name filter pattern masking specified and can also specify EXCLUDE MEMBER name pattern masking. The replace option can be specified on the data set level in an exclusive copy or load.
Example:
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))
//SYSIN DD *
COPY INDD=(SYSUT1),OUTDD=SYSUT2
EXCLUDE MEMBER=B
/*
Let’s discuss the example in detail.
- SYSUT1 DD defines a PDS DATASET1 that contains three members (A, B and C).
- SYSUT2 DD defines a new PDS DATASET2 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 except B.
- After the copy operation is finished, DATASET2 will contain the A and C that are from DATASET1.