Let's understand Mainframe
Home Tutorials Interview Q&A Quiz Mainframe Memes Contact us About us

Module 6: JCL Utilities


IEBCOPY

IEBCOPY mostly used to copy all or part of PDS to another PDS

Other use includes:-

  • Copy partitioned data sets.
    • A PDS can be copied to another PDS or a PS dataset. This operation is called as Unloading.
    • A PDS are mostly backed up on tape dataset. In order to restore PDS from backup tapes to direct access devices, IEBCOPY can be used. This operation is called as Loading.
    • While copying you can also merge many input PDSs. DDnames are necessary for merge
  • Copy only selected members of PDS to another PDS
    • You can also assign new name to the copied member
  • Copy by excluding few members of PDS to another PDS
  • Compress partitioned dataset
    • IEBCOPY can be 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.

General Format:-

//STEPNAME EXEC PGM=IEBCOPY //SYSPRINT DD SYSOUT=* //SYSUT1 DD DSN=<input PDS which needs to be copied> //SYSUT2 DD DSN=<output PDS or PS where data will be written> //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

Let’s see how we can use IEBCOPY to achieve different purposes:-

To unload dataset

//STEPNAME EXEC PGM=IEBCOPY //SYSPRINT DD SYSOUT=* //SYSUT1 DD DSN=DEPT.FILE1,DISP=SHR //SYSUT2 DD DSN=DEPT.FILE2, // DISP=(NEW,KEEP), // UNIT=TAPE1,VOL=SER=2345 //SYSIN DD * COPY INDD=SYSUT1, OUTDD=SYSUT2 /* //

  • In above code snippet, PDS specified in SYSUT1 will be copied to tape dataset SYSUT2

To load dataset

//STEPNAME EXEC PGM=IEBCOPY //SYSPRINT DD SYSOUT=* //SYSUT1 DD DSN=DEPT.FILE2,DISP=OLD,UNIT=TAPE1 //SYSUT2 DD DSN=DEPT.FILE3, // DISP=(NEW,CATLG), // UNIT=DISK1,SPACE=(TRK,(50,10)) //SYSIN DD * COPY INDD=SYSUT1, OUTDD=SYSUT2 /* //

To copy only selected members and rename member while copying

//STEPNAME EXEC PGM=IEBCOPY //SYSPRINT DD SYSOUT=* //SYSUT1 DD DSN=DEPT.FILE1,DISP=SHR //SYSUT2 DD DSN=DEPT.FILE4,DISP=SHR //SYSIN DD * COPY INDD=SYSUT1, OUTDD=SYSUT2 SELECT MEMBER=(MEMBER1,MEMBER2,MEMBER3) /* //

  • In above code snippet only members with name MEMBER1,MEMBER2 and MEMBER3 will be copied from PDS ‘DEPT.FILE1’ to PDS ‘DEPT.FILE4’
  • We can assign a new name to the copied member using following form of SELECT command
    SELECT MEMBER=(MEMBER1,(MEMBER2,NEWNAME2),MEMBER3)
    With use of this command MEMBER1 and MEMBER 3 will be copied with same name but MEMBER2 will be renamed to NEWNAME2.
  • While performing copy operation on an PDS with members existing, you can replace identically named members in the output dataset using following form of SELECT command
    SELECT MEMBER=(MEMBER1,(MEMBER2, ,R),MEMBER3)

To perform copy by excluding few members of PDS to another PDS

//STEPNAME EXEC PGM=IEBCOPY //SYSPRINT DD SYSOUT=* //SYSUT1 DD DSN=DEPT.FILE1,DISP=SHR //SYSUT2 DD DSN=DEPT.FILE5,DISP=SHR //SYSIN DD * COPY INDD=SYSUT1, OUTDD=SYSUT2 EXCLUDE MEMBER=(MEMBER7,MEMBER8,MEMBER9) /* //

  • In above snippet EXCLUDE command will ensure that all member from DEPT.FILE1 will be copied to DEPT.FILE5 excluding members having name MEMBER7,MEMBER8,MEMBER9

To compress dataset

//STEPNAME EXEC PGM=IEBCOPY //SYSPRINT DD SYSOUT=* //SYSUT1 DD DSN=DEPT.FILE1,DISP=SHR //SYSIN DD * COPY INDD=SYSUT1, OUTDD=SYSUT1 /* //

  • In above code snippet COPY command is used in which we have specified same DDname for both INDD(input file) and OUTDD(output file). This form of COPY command is used to compress dataset



Advertisements






© copyright mainframebug.com
Privacy Policy