Tags

, , , ,

IEBCOPY Examples

In the following examples, replace infile and outfile with any unique input and output DD names, and replace inpds with the name of the PDS to be copied and outpds with the name of the output PDS.

  • To copy an entire PDS to another PDS:
       // EXEC PGM=IEBCOPY 
       //SYSPRINT DD SYSOUT=A 
       //infile  DD DSN=inpds,DISP=SHR 
       //outfile  DD DSN=outpds,DISP=SHR 
       //SYSIN DD * 
       COPY OUTDD=outfile,INDD=infile 
       /* 
  • To unload a PDS to a sequential tape file on a standard labeled cartridge tape:
       /*JOBPARM T=1 
       // EXEC PGM=IEBCOPY 
       //SYSPRINT DD SYSOUT=A 
       //SYSUT1  DD DSN=inpds,DISP=SHR 
       //SYSUT2  DD DSN=tape.dataset.name,UNIT=TAPE, 
       //   VOL=SER=tape#,LABEL=#,DISP=(NEW,PASS) 
       //SYSIN  DD DUMMY 
  • To reload a PDS with same DCB attributes as it had originally from an unloaded tape file (assumes the PDS already exists):
       /*JOBPARM T=1 
       // EXEC PGM=IEBCOPY 
       //SYSPRINT DD SYSOUT=A 
       //SYSUT1  DD DSN=tape.dataset.name,DISP=(OLD,PASS), 
       //   UNIT=TAPE,VOL=SER=tape#,LABEL=# 
       //SYSUT2  DD  DSN=outpds,DISP=SHR 
       //SYSIN  DD  DUMMY 
  • To copy only particular members of one PDS to be new members of another PDS, where mbr1, mbr2,…, mbrn are the names of the members to be copied:
       // EXEC PGM=IEBCOPY 
       //SYSPRINT DD SYSOUT=A 
       //infile  DD DSN=inpds,DISP=SHR 
       //outfile  DD DSN=outpds,DISP=SHR 
       //SYSIN  DD * 
         COPY OUTDD=outfile,INDD=infile 
         SELECT MEMBER=(mbr1,mbr2,...,mbrn) 
       /* 
  • To copy all but particular members of one PDS to another PDS without replacing duplicately named members, where mbr1, mbr2,…,mbrn are the members in the input PDS to be excluded:
       // EXEC PGM=IEBCOPY 
       //SYSPRINT DD SYSOUT=A 
       //infile  DD DSN=inpds,DISP=SHR 
       //outfile  DD DSN=outpds,DISP=SHR 
       //SYSIN  DD * 
         COPY OUTDD=outfile,INDD=infile 
         EXCLUDE MEMBER=(mbr1,mbr2,...,mbrn) 
       /* 
  • A merged dataset is one to which an additional member or members are copied or loaded. It is created by copying or loading the additional member(s) to an existing output PDS. To merge all members of several partitioned datasets to another PDS, where inpds1, inpds2,…,inpdsn are the names of the partitioned datasets to be copied and infile1, infile2,…,infilen are unique arbitrary DD names:
      // EXEC PGM=IEBCOPY 
       //SYSPRINT DD SYSOUT=A 
       //infile1  DD DSN=inpds1,DISP=SHR 
       //infile2  DD DSN=inpds2,DISP=SHR 
       . 
       . 
       . 
       //infilen  DD DSN=inpdsn,DISP=SHR 
       //outfile  DD DSN=outpds,DISP=SHR 
       //SYSIN  DD * 
         COPY OUTDD=outfile,INDD=(infile1,infile2,...,infilen) 
       /* 
  • To copy particular members of one PDS to another PDS, where mbri is to be renamed, and newnamei is mbri’s new name:
     // EXEC PGM=IEBCOPY 
       //SYSPRINT DD SYSOUT=A 
       //infile  DD DSN=inpds,DISP=SHR 
       //outfile  DD DSN=outpds,DISP=SHR 
       //SYSIN  DD * 
         COPY OUTDD=outfile,INDD=infile 
         SELECT MEMBER=(mbr1,...,(mbri,newnamei),...,mbrn) 
       /* 
  • To copy all members of a PDS to another PDS, replacing all duplicately-named members in the output PDS (the “R” in the INDD parameter implies that replace mode is to be used):
       // EXEC PGM=IEBCOPY 
       //SYSPRINT DD SYSOUT=A 
       //infile  DD DSN=inpds,DISP=SHR 
       //outfile  DD DSN=outpds,DISP=SHR 
       //SYSIN  DD * 
         COPY OUTDD=outfile,INDD=(infile,R) 
       /* 
  • To copy only particular members of one PDS to another PDS, replacing any duplicately-named members, use the following control statements:
         COPY OUTDD=outfile,INDD=((infile,R)) 
         SELECT MEMBER=(mbr1,mbr2,...,mbrn) 
  • If particular members of one PDS are to be copied to another PDS and the ith member is to be replaced, use the following control statements:
         COPY OUTDD=outfile,INDD=infile 
         SELECT MEMBER=(mbr1,mbr2,...,(mbri,R),...,mbrn) 
  • If mbri is to replace any member in the output PDS by the name of newnamei, use the following control statements:
         COPY OUTDD=outfile,INDD=infile 
         SELECT MEMBER=(mbr1,mbr2,...,(mbri,newnamei,R),...,mbrn) 
  • To copy particular members of several partitioned datasets to one PDS, without replacing duplicately-named members (note that EXCLUDE will omit all occurrences of the member names specified in all the files specified; SELECT will copy only the first occurrence of each member):
       // EXEC PGM=IEBCOPY 
       //SYSPRINT DD SYSOUT=A 
       //infile1  DD DSN=inpds1,DISP=SHR 
       //infile2  DD DSN=inpds2,DISP=SHR 
            . 
            . 
            . 
       //infilez  DD DSN=inpdsz,DISP=SHR 
       //outfile  DD DSN=outpds,DISP=SHR 
       //SYSIN  DD * 
         COPY OUTDD=outfile,INDD=infile1,infile2,...,infilei 
         SELECT MEMBER=mbr1,mbr2,...,mbri 
         INDD=infilej,infilek,...,infilen 
         EXCLUDE MEMBER=mbrj,mbrk,...,mbrn 
         INDD=infileo,infilep,...,infilez 
       /* 

The PDS pointed to by DD statements infile1 through infilei is searched for mbr1 through mbri. If found, they are copied to the PDS pointed to by the DD statement outfile without replacing duplicately-named members. All members except mbrj through mbrn of the datasets pointed to by the DD statements infilej through infilen are copied to the output dataset without replacement. All members of the files infileo through infilez will be copied to the output dataset without replacing. If desired, use the “R” parameter to replace any duplicately-named members in the output PDS.

Important SQL CODES and ABEND CODES
SORT JOIN – TO JOIN TWO FILES BASED ON A KEY
KNOW YOUR MAINFRAME
REXX – INITIAL SETUP
IDCAMS – Define VSAM ESDS
IDCAMS – Define VSAM RRDS
IDCAMS – Define VSAM KSDS
IDCAMS – Define Alternate Index (AIX)
IDCAMS – Define PATH for Alternate Index
IDCAMS – Define GDG
IDCAMS – Alter GDG, VSAM or PS File
IDCAMS – Delete GDG, VSAM or PS File
IDCAMS – Print VSAM File
IDCAMS
Recovery of Deleted Tape data set (Using Volume Serial)
JCL – SYSIN CONCATENATION
JCL – RUN ONLY ONE MIDDLE STEP (RESTART)
GDG – Delete Just Versions Not BASE
JCL – COPY DCB OF INPUT FILE TO OUTPUT FILE
HOW TO SUBMIT A JOB AUTOMATICALLY AFTER A JOB FINISHES
DELETE ALL GDG VERSIONS WITHOUT DELETING BASE
LISTCAT – BATCH JOB
IEBCOPY Examples
IEBGENER – INTERNAL READER TO SUBMIT
Delete Multiple datasets with same HLQ
JCL INTERVIEW QUESTIONS
JCL TIPS
Advertisements