IEBCOPY

IEBCOPY


IEBCOPY is used to copy all or a part of a PDS or PDSE. Selected members of a PDS or PDSE can be copied to another or the same PDS or PDSE and/or renamed.  A sequential backup copy of a sequential copy previously created by an unload.  You can load a PDS to an SMS managed PDSE.  Copying a PDSE to a PDS can be done, but application information stored in the directory of the PDSE will be lost.  Altering RLD counts for load modules in place can also be done. You can optionally re-block load modules during a copy operation. Finally, IEBCOPY is used to "compress" a PDS when all of its unused internal space has been exhausted.  The compress operation reorganizes a PDS so that all previously unused space inside the PDS is reclaimed.

Sample IEBCOPY JCL:

//STEPCOPY EXEC PGM=IEBCOPY          
//OLDFILE  DD DSN=G1SG00AT.OFFSHORE.PARMLIB,DISP=SHR           
//NEWFILE  DD DSN=G1SG00AT.BACKUP.PARMLIB,DISP=OLD         
//SYSUT3   DD UNIT=SYSDA,SPACE=(TRK,(30,30),RLSE)
//SYSUT4   DD UNIT=SYSDA,SPACE=(TRK,(30,30),RLSE)
//SYSOUT   DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSIN    DD *                               
 <control statements>
/*

Valid control statements are COPY, ALTERMOD, COPYMOD, SELECT, and EXCLUDE. Control statements are continued by placing a non-blank character in column 72 and continuing the statement beginning in column 16 on the next statement. The syntax and usage of each is discussed below:

·         COPY


This statement indicates the beginning of a copy operation and identifies the DD statements to be used during the copy.  The format of the COPY control statement is:

{label} COPY OUTDD=ddname,
        INDD=(ddname1,ddname2,(ddname3,R),...)
        {,LIST=NO}

The LIST=NO keyword is optional and tells IEBCOPY that you don't want a list of the members in the PDS.

COPY can be abbreviated as 'C', OUTDD as 'O', and INDD as 'I'.

Note : When copying from a sequential file or a PDS to another PDS, specify the 'R' parameter after the input DD name if you want ALL identically named members replaced on the output file.

Identically named members are only replaced on a copy operation if you request the REPLACE option on the COPY statement, or on the SELECT statement, described later. COPY Statement examples follow:

Example 1 - Copy all with replace.

 {label} COPY OUTDD=O,INDD=((I,R))

Example 2 - Copy without replace.

 {label} C O=TAPE,I=DASD

Example 3 - Compress-in-place!

 {label} COPY OUTDD=SYSUT1,I=SYSUT1


·         SELECT


The SELECT statement is used to name members to be included in a  copy operation.  The SELECT statement must be preceded by a COPY or COPYMOD statement, or the INDD= portion of a COPY statement. A SELECT statement may not appear in the same COPY operation as an EXCLUDE statement, neither can SELECT be used in a compress operation. A SELECT member is only replaced in the output data set if the REPLACE option ('R') is set on the SELECT statement or on the INDD portion of the COPY statement.  Possible formats of the SELECT control statement are:

Format 1 - Copy selected members.

{label} SELECT MEMBER=name

Format 2 - Copy a list of members.

{label} SELECT MEMBER=(name1,name2,name3...)

Format 3 - Copy a list of members and rename them.

{label} SELECT MEMBER=((name1,newname1),(name2,newname2),...)

Format 4 - Copy a list of members and replace them if they are already in the output data set.

{label} SELECT MEMBER=((name1,,R),(name2,,R),...)

·         EXCLUDE


The EXCLUDE statement is used to name members to be excluded from A copy operation.  The EXCLUDE statement must be preceded by a COPY or COPYMOD statement, or the INDD= portion of a COPY statement.  An EXCLUDE statement may not appear in the same COPY operation as a SELECT statement, neither can EXCLUDE be used in a compress operation. The format of the SELECT control statement is:

Format -

{label} EXCLUDE MEMBER=(name1,name2,name3,...)

·         JCL to compress a PDS


//JS10    EXEC PGM=IEBCOPY,REGION=1M
//SYSPRINT  DD SYSOUT=*
//I1        DD DSN=G1SG00AT.OFFSHORE.JCL,DISP=OLD
//O1        DD DSN=G1SG00AT.OFFSHORE.JCL,DISP=OLD
//SYSIN     DD *
  COMP1 C O=O1,I=((I1,R))

Or

//COMPRESS EXEC  PGM=IEBCOPY,REGION=0K
//SYSPRINT DD SYSOUT=*
//PDSIN    DD DSN=PUFAP.PARMLIB.CYCLE,DISP=SHR
//PDSOUT   DD DSN=PUFAP.PARMLIB.CYCLE,DISP=OLD
//SYSIN    DD *
  COPY INDD=PDSIN,OUTDD=PDSOUT


·         JCL to unload a PDS to a tape


//STEP1   EXEC PGM=IEBCOPY,REGION=1024K
//SYSPRINT  DD SYSOUT=*
//I1        DD DSN= G1SG00AT.OFFSHORE.JCL,DISP=OLD
//O1        DD DSN= G1SG00AT.OFFSHORE.JCL.TAPE.COPY,
//             DISP=(NEW,CATLG,DELETE),UNIT=TAPE
//SYSIN     DD *
  COPY1 C O=O1,I=((I1,R))


·         JCL to load a PDS to DASD from a sequential unloaded copy


//PDSLOAD EXEC PGM=IEBCOPY,REGION=1M
//SYSPRINT  DD SYSOUT=*
//I1        DD DSN=G1SG00AT.OFFSHORE.JCL.SEQ.COPY,DISP=OLD
//O1        DD DSN=G1SG00AT.OFFSHORE.JCL,
//             DISP=(NEW,CATLG,DELETE),UNIT=SYSDA,
//             SPACE=(TRK,(30,30,10),RLSE)
//SYSIN     DD *
  COPY1 C O=O1,I=((I1,R))


·         JCL to copy 4 members from one PDS to another


//PDSCOPY EXEC PGM=IEBCOPY,REGION=1024K
//SYSPRINT  DD SYSOUT=*
//I1        DD DSN=G1SG00AT.OFFSHORE.JCL,DISP=SHR
//O1        DD DSN=G1SG00AT.PRODVER.JCL,DISP=SHR
//SYSIN     DD *
  COPY1 C O=O1,I=((I1,R))
  SELC1 S M=MEMBER1,MEMBER2
  SELC2 S M=((MEMBER3,NEWMEM3),MEMBER4)

Comments

Popular posts from this blog

Date/time constants in JCL

JCL ABeND --

IEBGENER usage examples