IEBCOPY selective copy using select statements

Selective copy in IEBCOPY allows you to copy only specific members from a source PDS to a target PDS, instead of copying the entire dataset. This is useful when you need only a few members and want to avoid duplicating everything. you can achieve this by using the (SELECT MEMBER=xxx) statements in the SYSIN section.

EXAMPLE:

Selective Member Copy from PDS

//IEBCOPY  JOB (12345),'SELECTIVE COPY',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  
  SELECT MEMBER=PROG1,PROG2
/*   

Explanation:

EXEC Statement: Executes the IEBCOPY utility to copy specific members.

DD Statement:

SYSUT1 DD: Specifies the input PDS (T12345.SOURCE.PDS) that contains the members to be copied.

SYSUT2 DD: Specifies the output PDS (T12345.TARGET.PDS) where the selected members will be copied.

SYSPRINT DD: Sends operation logs and messages to the system output (SYSOUT). SYSPRINT DD

SYSIN DD: Contains the control statements:

  • COPY INDD=SYSUT1, OUTDD=SYSUT2: tells IEBCOPY to perform the copy operation.

  • SELECT MEMBER=PROG1,PROG2 : specify which members to copy from the source PDS.

This program selectively copies only the PROG1 and PROG2 members from the source PDS to the target PDS, making the operation efficient when full dataset copying is not needed.

Last updated

Was this helpful?