Summary -
In this topic, we described about the EXCLUDE with detailed example.
Specifies members in the input data set to be excluded from the copy step. The EXCLUDE statement specifies members to be excluded from the copy, unload, or load step.
An EXCLUDE statement cannot appear with a SELECT statement in the same copy, unload, or load step. The EXCLUDE statement cannot be used with a compress-in-place or COPYGRP.
Syntax:
Label | Statement | Parameters |
---|---|---|
[label] | EXCLUDE | MEMBER=[(]name1[,name2][,...][)] |
MEMBER=[(]name1[, name2][,...][)]
specifies members on the input data set that are not to be copied, unloaded, or loaded to the output data set.
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.