COPYGRP


COPYGRP statement is used to perform a group copy, unload, or load from source PDS to target. A group can consist of members and their aliases.

Syntax -

//SYSIN     DD  *
  	[label] COPYGRP OUTDD=DDname,INDD={DDname|((DDname,R))} 
	[LIST={YES|NO}]
	[GENS={ALL| NONE}]
/*
  • OUTDD=DDname - Specifies the DDname of the output PDS.
  • INDD=[(]{DDname|(DDname,R) }[,...][)] - Specifies the DDname of the input PDS.
  • R - Specifies that the members to be copied or loaded from the input data set will replace any identically named members on the output PDS.
  • LIST={YES|NO} - Specifies that the altered member names to be listed in the SYSPRINT dataset. When ignored, the default listing option from the EXEC PARM gets applied.
  • GENS={ALL| NONE} - Specifies that all members and their generations to be copied or not.

Practical Example -


Scenario - Copying members and their aliases from one PDS to another.

JCL -

----+----1----+----2----+----3----+----4----+----5----+
//MATEPKC  JOB (123),'MTH',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),
//             NOTIFY=&SYSUID
//********************************************************
//* TO COPY SELECTED MEMBERS FROM ONE PDS TO ANOTHER PDS  
//********************************************************
//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=OLD
//SYSIN    DD *
      COPYGRP   INDD=SYSUT1,OUTDD=SYSUT2
      SELECT MEMBER=(IDENTDIV,LEVELNUM)
/*

Job Status -

COPYGRP Job Status

Output -

COPYGRP Output

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=(IDENTDIV,LEVELNUM) - Copies members COPY, COPYPDS from SYSUT1 to SYSUT2.