Excluding Members from a Copy
Excluding Members from a Copy
IEBCOPY EXCLUDE statement used to exclude the coded members during the copy, unload, and load operations. The excluded member is searched on every input PDS and is omitted.
A maximum of eight characters can be allowed for the member or alias name on a copy operation. EXCLUDE is not allowed for COPYGRP.
Practical Example -
Scenario - Exclude one member and copy remaining members from one PDS to another.
Input -

JCL -
----+----1----+----2----+----3----+----4----+----5----+
//MATEPKC JOB (123),'MTH',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),
// NOTIFY=&SYSUID
//***********************************************************
//* EXCLIDING MEMBERS WHILE COPY FROM ONE PDS TO ANOTHER
//***********************************************************
//STEP10 EXEC PGM=IEBCOPY
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSDUMP DD SYSOUT=*
//SYSUT1 DD DSN=MATEPK.IEBCOPY.INPPDS,DISP=SHR
//SYSUT2 DD DSN=MATEPK.IEBCOPY.OUTPDS,
// DISP=(NEW,CATLG,DELETE),
// SPACE=(TRK,(10,10,10),RLSE),
// UNIT=3390,VOL=SER=DEVHD4,
// DCB=(DSORG=PO,RECFM=FB,LRECL=80,BLKSIZE=800)
//SYSIN DD *
COPY INDD=SYSUT1,OUTDD=SYSUT2
EXCLUDE MEMBER=MAINPROG
/*
Job Status -

Output -

Explaining Example -
- SYSUT1 DD DSN=MATEPK.IEBCOPY.INPPDS,.. - Specifies the input PDS.
- SYSUT2 DD DSN=MATEPK.IEBCOPY.OUTPDS,.. - Specifies the output PDS.
- COPY INDD=SYSUT1,OUTDD=SYSUT2
EXCLUDE MEMBER=MAINPROG - Copies all other members except MAINPROG from SYSUT1 to SYSUT2.