IEBCOPY Exclude members while copying

EXAMPLE:

Exclude Members While Copying PDS

//IEBCOPY  JOB (12345),CLASS=A,MSGCLASS=X,NOTIFY=&SYSUID  
//STEP1    EXEC PGM=IEBCOPY  
//SYSPRINT DD SYSOUT=*  
//SYSUT1   DD DSN=T12345.SOURCE.PDS,DISP=SHR  
//SYSUT2   DD DSN=T12345.TARGET.PDS,DISP=SHR  
//SYSIN    DD *  
  COPY OUTDD=SYSUT2,
  INDD=SYSUT1  
  EXCLUDE MEMBER=TEMP1,OLDPGM 
/*  

Explanation:

EXEC Statement: Executes the IEBCOPY utility to copy members from one PDS to another, excluding specific ones.

DD Statement:

SYSUT1 DD: Specifies the input PDS (T12345.SOURCE.PDS) that contains all the members.

SYSUT2 DD: Specifies the output PDS (T12345.TARGET.PDS) where the members will be copied, except the excluded ones.

SYSPRINT DD: Outputs logs and messages related to the copy process.

SYSIN DD: Contains the control statements:

  • COPY INDD=SYSUT1,OUTDD=SYSUT2: initiates the copy operation.

  • EXCLUDE MEMBER=TEMP ,OLDPGM: tell IEBCOPY to skip copying these specific members.

This JCL copies all members from the source PDS to the target PDS except the ones explicitly excluded (TEMP1 and OLDPGM). It’s helpful when you want to copy almost everything but leave out outdated or unnecessary members

Last updated

Was this helpful?