Selecting Members for Copy/Unload/Load


IEBCOPY SELECT statement is used to select members from one or more PDS during the copy. Selected members are searched in an a-to-z order, regardless of the coded order in the SELECT statement.

When using COPYGRP, use SELECT MEMBER filter masking name instead of specifying a full member name. The filter characters asterisk (*) and percent sign (%) used to code the partial member name.

Points to note -

  • SELECT and EXCLUDE statements can’t be used in the same COPY operation.
  • Members can be renamed while copying.

Practical Example -


Scenario - Copying three selected members (COPY) from one PDS to another.

JCL -

----+----1----+----2----+----3----+----4----+----5----+
//MATEPKS  JOB (123),'MTH',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),
//             NOTIFY=&SYSUID
//*************************************************** 
//* SELETING MEMBER(S) FROM INPUT PDS DURING COPY  
//***************************************************
//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=SHR
//SYSIN    DD *
     COPY INDD=SYSUT1,OUTDD=SYSUT2
     SELECT MEMBER=FIRSTPRG,IDENTDIV,LEVELNUM 
/* 

Job Status -

Selecting Members for Copy

Output -

Selecting Members for Copy

Explaining Example -

  • SYSUT1 DD DSN=MATEPK.IEBCOPY.INPPDS - Specifies the input PDS.
  • SYSUT2 DD DSN=MATEPK.IEBCOPY.OUTPDS - Specifies the output PDS.
  • COPYGRP INDD=SYSUT1,OUTDD=SYSUT2 - Copies members from SYSUT1 to SYSUT2.
  • SELECT MEMBER=FIRSTPRG,IDENTDIV,LEVELNUM - Copies member FIRSTPRG,IDENTDIV and LEVELNUM from SYSUT1 to SYSUT2.