arrow-left

All pages
gitbookPowered by GitBook
1 of 10

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

IEBCOPY selective copy using select statements

Selective copy in IEBCOPY allows you to copy only specific members from a source PDS to a target PDS, instead of copying the entire dataset. This is useful when you need only a few members and want to avoid duplicating everything. you can achieve this by using the (SELECT MEMBER=xxx) statements in the SYSIN section.

EXAMPLE:

Selective Member Copy from PDS

//IEBCOPY  JOB (12345),'SELECTIVE COPY',CLASS=A,MSGCLASS=X,NOTIFY=&SYSUID  
//STEP1    EXEC PGM=IEBCOPY  
//SYSPRINT DD SYSOUT=*  
//SYSUT1   DD DSN=T12345.SOURCE.PDS,DISP=SHR  
//SYSUT2   DD DSN=T12345.TARGET.PDS,DISP=SHR  
//SYSIN    DD *  
  COPY OUTDD=SYSUT2,
  INDD=SYSUT1  
  SELECT MEMBER=PROG1,PROG2
/*   

Explanation:

EXEC Statement: Executes the IEBCOPY utility to copy specific members.

DD Statement:

SYSUT1 DD: Specifies the input PDS (T12345.SOURCE.PDS) that contains the members to be copied.

SYSUT2 DD: Specifies the output PDS (T12345.TARGET.PDS) where the selected members will be copied.

SYSPRINT DD: Sends operation logs and messages to the system output (SYSOUT). SYSPRINT DD

SYSIN DD: Contains the control statements:

  • COPY INDD=SYSUT1, OUTDD=SYSUT2: tells IEBCOPY to perform the copy operation.

  • SELECT MEMBER=PROG1,PROG2 : specify which members to copy from the source PDS.

This program selectively copies only the PROG1 and PROG2 members from the source PDS to the target PDS, making the operation efficient when full dataset copying is not needed.

Generate PDS member while copying

EXAMPLE:

Copying a Sequential Dataset into a PDS Member

//IEBGENER JOB (12345), CLASS=A, MSGCLASS=X,NOTIFY=&SYSUID
//STEP1 EXEC PGM=IEBGENER
//SYSUT1 DD DSN=T12345.FILE1.PS, DISP=SHR
//SYSUT2 DD DSN=T12345.FILE2.PDS, DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD DD*
        GENERATE MAXNAME=1
        MEMBER NAME = MEMBER1
//

Explanation:

  • EXEC Statement: Executes the IEBGENER utility to copy data.

  • DD Statements:

    • SYSUT1 DD: Specifies the input dataset T12345.FILE1.PS, which is a sequential dataset.

    • SYSUT2 DD: Specifies the output dataset as a partitioned dataset (PDS), T12345.FILE2.PDS, where a new member will be created.

    • SYSPRINT DD: Directs informational messages or logs to system output (SYSOUT=*).

  • SYSIN DD: Uses in-stream data to specify the generation of a new member in the PDS with the following parameters:

    • GENERATE MAXNAME=1: Specifies that one member will be generated.

    • MEMBER NAME=MEMBER1: Creates a member named (MEMBER1) in the partitioned dataset (T12345.FILE2.PDS).

This program uses the IEBGENER utility to copy data from a sequential dataset (T12345.FILE1.PS) into a newly generated member (MEMBER1) within the partitioned dataset (T12345.FILE2.PDS). The (GENERATE) keyword within SYSIN ensures that the member is created with the specified name.

SYSOUT DD: Handles general system output, directed to the default system output (SYSOUT=*).

Copying Between Sequential Datasets and PDS Members Using IEBGENER

EXAMPLE 1:

Copying a PDS Member to a Sequential Dataset using IEBGENER

Explanation:

  • EXEC Statement:

    • Executes the IEBGENER utility to copy data.

  • DD Statements:

    • SYSUT1 DD:

      • DSN=T12345.FILE1.PDS(MEMBER1): Specifies the input file as a PDS member (MEMBER1) from the PDS dataset (T12345.FILE1.PDS).

EXAMPLE 2:

Copying a Sequential Dataset to a PDS Member

Explanation:

  • EXEC Statement:

    • Executes the IEBGENER utility to copy data.

  • DD Statements:

//IEBGENER JOB (12345),CLASS=A, MSGCLASS=X,NOTIFY=&SYSUID 
//STEP1 EXEC PGM=IEBGENER 
//SYSUT1 DD DSN=T12345.FILE1.PDS(MEMBER1), DISP=SHR 
//SYSUT2 DD DSN=T12345.FILE2.PS, DISP=SHR 
//SYSPRINT DD SYSOUT=* 
//SYSOUT DD SYSOUT=* 
//SYSIN DD DUMMY
SYSUT2 DD:
  • DSN=T12345.FILE2.PS: Specifies the output dataset as a sequential (PS) dataset (T12345.FILE2.PS).

  • SYSPRINT DD:

    • Directs messages and logs to the system output (SYSOUT=*).

  • SYSOUT DD:

    • Directs general system output to standard system output (SYSOUT=*).

  • This program uses IEBGENER to copy a specific member (MEMBER1) from a partitioned dataset (T12345.FILE1.PDS) to a sequential dataset (T12345.FILE2.PS). It reads the content of the PDS member from SYSUT1 and writes it to the sequential dataset specified in SYSUT2

    SYSUT1 DD:

    • DSN=T12345.FILE1.PS: Specifies the name of the input dataset (T12345.FILE1.PS), which is a sequential dataset (PS).

  • SYSUT2 DD:

    • DSN=T12345.FILE2.PDS(MEMBER1): Specifies the output location as a PDS member (MEMBER1) in the partitioned dataset (T12345.FILE2.PDS).

  • SYSPRINT DD:

    • Directs informational messages and logs to system output (SYSOUT=*).

  • SYSOUT DD:

    • Handles general system output, also directed to the default system output (SYSOUT=*)

  • This program uses the IEBGENER utility to copy data from a sequential dataset (T12345.FILE1.PS) to a member (MEMBER1) of a partitioned dataset (T12345.FILE2.PDS). It reads the content from the sequential dataset specified in SYSUT1 and writes it into the specified PDS member in SYSUT2

    //IEBGENER JOB (12345),CLASS=A, MSGCLASS=X,NOTIFY=&SYSUID 
    //STEP1 EXEC PGM=IEBGENER 
    //SYSUT1 DD DSN=T12345.FILE1.PS, DISP=SHR
    //SYSUT2 DD DSN=T12345.FILE2.PDS(MEMBER1), DISP=SHR
    //SYSPRINT DD SYSOUT=* 
    //SYSOUT DD SYSOUT=* 
    //SYSIN DD DUMMY

    IEBCOPY

    • IEBCOPY is used to copy, merge, and compress Partitioned Datasets (PDS) or Partitioned Dataset Extended (PDSE).

    • It is primarily used for copying members between PDS/PDSE datasets and for creating backups of partitioned datasets.

    • IEBCOPY can copy an entire PDS/PDSE, selected members, or compress a PDS by removing unused space

    • Lists the number of unused directory blocks for efficient dataset utilization.

    EXAMPLE:

    Copy from one PDS to another PDS

    hashtag
    Explanation:

    EXEC Statement: Executes the IEBCOPY utility to copy members.

    DD Statement:

    • SYSUT1 DD: Specifies the input PDS (T12345.SOURCE.PDS) that contains the members to be copied.

    • SYSUT2 DD: Specifies the output PDS (T12345.TARGET.PDS) where the members will be copied to.

    • SYSPRINT DD: Sends the copy operation log and messages to SYSOUT.

    This IEBCOPY JCL program copies all members from one Partitioned Dataset (PDS) (T12345.SOURCE.PDS) to another PDS (T12345.TARGET.PDS).

    SYSIN DD: Contains control statements. COPY INDD=SYSUT1,OUTDD=SYSUT2, tells IEBCOPY to copy all members from the input PDS to the output PDS
    //IEBCOPY  JOB (12345),CLASS=A,MSGCLASS=X,NOTIFY=&SYSUID
    //STEP1    EXEC PGM=IEBCOPY
    //SYSPRINT DD SYSOUT=*                         
    //SYSUT1   DD DSN=T12345.SOURCE.PDS,DISP=SHR     
    //SYSUT2   DD DSN=T12345.TARGET.PDS,DISP=SHR     
    //SYSIN    DD *                                  
     COPY INDD=SYSUT1,
     OUTDD=SYSUT2                  
    /*
    

    Copying a UNIX File to a PS File

    EXAMPLE:

    Copying a UNIX System Services (USS) File to a Sequential Dataset

    //IEBGENER JOB (12345), CLASS=A, MSGCLASS=X,NOTIFY=&SYSUID
    //STEP1 EXEC PGM=IEBGENER
    //SYSPRINT DD SYSOUT=*
    //SYSUT1 DD PATH='/mth9/input1/transfer.mon',
    //          FILEDATA=TEXT,PATHOPTS=ORDONLY
    
    //SYSUT2 DD DSN=T12345.FILE2.PS, DISP=SHR
    //SYSPRINT DD SYSOUT=*
    //SYSIN DD DUMMY

    Explanation:

    • EXEC Statement: Executes the IEBGENER utility, which is used for copying datasets.

    • DD Statements:

      • SYSUT1 DD: Defines the input source as a UNIX file located at /mth9/input1/transfer.mon. The file data is defined as TEXT, meaning the file will be read as text, and the file will be accessed in a read-only mode (ORDONLY)

      • SYSUT2 DD: Specifies the output dataset as a physical sequential (PS) dataset T12345.FILE2.PS

      • SYSPRINT DD: Directs informational messages and logs to the system output (SYSOUT=*), which is the standard output.

    This job copies the contents of a UNIX file (/mth9/input1/transfer.mon) to an existing PS dataset (T12345.FILE2.PS).

    SYSIN DD: Uses DUMMY, meaning that no input control statements are needed for this operation.

    IEBGENER

    IEBGENER is used to copy a record from a sequential dataset or convert a dataset from PS to PDS or PDS to PS dataset

    Copy operation can be performed on all types of records having different various record length

    IEBGENER can use either a Physical Sequential (PS) dataset, a Partitioned Dataset (PDS) member, or a Partitioned Dataset Extended (PDSE) member as input and a new or existing PS file or PDS or PDSE member as an output

    EXAMPLE:

    Copying Data Between Two Sequential Datasets:

    //IEBGENER JOB (12345),CLASS=A, MSGCLASS=X,NOTIFY=&SYSUID 
    //STEP1 EXEC PGM=IEBGENER 
    //SYSUT1 DD DSN=T12345.FILE1.PS, DISP=SHR 
    //SYSUT2 DD DSN=T12345.FILE2.PS, DISP=SHR 
    //SYSPRINT DD SYSOUT=* 
    //SYSOUT DD SYSOUT=* 
    //SYSIN DD DUMMY

    Explanation:

    EXEC Statement:

    • Executes the IEBGENER program, which compares two datasets.

    DD Statements:

    • SYSUT1 DD:

      • DSN=T12345.FILE1.PS: Specifies the name of the input dataset.

    • SYSUT2 DD:

    This program uses the IEBGENER utility to copy data from the input dataset (T12345.FILE1.PS) to the output dataset (T12345.FILE2.PS). It reads the data from SYSUT1 and writes it to SYSUT2

    DSN=T12345.FILE2.PS: Specifies the name of the output dataset.
  • SYSPRINT DD:

    • Directs the output and informational messages to the standard output (SYSOUT=*).

  • SYSOUT DD:

    • Also directs general system output to SYSOUT=* (standard system output).

  • IEBCOPY renaming member while copying

    EXAMPLE:

    Renaming a Member While Copying

    //IEBCOPY  JOB (12345),'RENAME COPY',CLASS=A,MSGCLASS=X,NOTIFY=&SYSUID  
    //STEP1    EXEC PGM=IEBCOPY  
    //SYSPRINT DD SYSOUT=*  
    //SYSUT1   DD DSN=T12345.SOURCE.PDS,DISP=SHR  
    //SYSUT2   DD DSN=T12345.TARGET.PDS,DISP=SHR  
    //SYSIN    DD *  
      COPY OUTDD=SYSUT2,
      INDD=SYSUT1  
      SELECT MEMBER=((OLDNAME,NEWNAME)) 
    /*  

    Explanation:

    EXEC Statement: Executes the IEBCOPY utility program to copy and rename members in a Partitioned Dataset (PDS).

    DD Statement:

    SYSUT1 DD: Specifies the source PDS (T12345.SOURCE.PDS) that contains the original member (OLDNAME).

    SYSUT2 DD: Specifies the target PDS (T12345.TARGET.PDS) where the renamed member (NEWNAME) will be stored.

    SYSPRINT DD: Outputs logs and messages generated by IEBCOPY to the system output.

    SYSIN DD: Contains the control statements for the copy operation:

    • COPY OUTDD=SYSUT2, INDD=SYSUT1: Tells IEBCOPY to copy data from SYSUT1 to SYSUT2.

    • SELECT MEMBER=((OLDNAME, NEWNAME)): Instructs IEBCOPY to copy the member (OLDNAME) from the source PDS and rename it as (NEWNAME) in the target PDS.

    This JCL copies a member named OLDNAME from the source PDS (T12345.SOURCE.PDS) and saves it into the target PDS (T12345.TARGET.PDS) with a new name NEWNAME

    Utilities

    Utilities are simple programs or pre-written programs which perform commonly needed functions

    Utilities are widely used by system programmers and application developers to achieve day-to-day requirements, organizing and maintaining data.

    There are two types of utility they are dataset utilities and system utilities

    Dataset utilities:

    • Used to perform the task on the dataset

    • Name start with IEB

    • IEBCOPY, IEBEDIT, IEBCOMPR, IEBGENER are the few dataset utilities

    System utilities:

    • Used to perform the task on system Maintenace

    • Name starts with IEH

    • IEHMOVE, IEHLIST, IEHPROGM are the few System utilities

    Common JCL DD names:

    • SYSUT1: Input file

    • SYSUT2: Output file

    • SYSUT3: Work file for input (SYSUT1)

    IEBCOMPR

    IEBCOMPR

    • IEBCOMPR is used to compare a PS, PDS, PDSE dataset

    • It is useful for verifying the backups are done correctly

    SYSUT4: Work file for output (SYSUT2)
  • SYSIN: Used to pass parameters for the utility

  • SYSOUT: Output file for message from utility

  • SYSPRINT: Output file printed output from utility

  • SYSUDUMP: It's an output file for a system dump if program fails

  • PS datasets are considered equal if the dataset contain the same number of records and the corresponding records are identical
  • PDS, PDSE datasets are considered equal if both contain same number of members, the same number of records and the corresponding records are identical

  • The data sets being compared must have same record length and format

  • Return code 0 if the files are identical

  • Return code 8 if the files are not identical

  • EXAMPLE:

    Comparing two sequential data sets:

    Explanation:

    EXEC Statement:

    • Executes the IEBCOMPR program, which compares two datasets.

    DD Statements:

    • SYSUT1 DD:

      • DSN=T12345.FILE1.PS: Name of the first dataset to compare.

      SYSUT2 DD:

      • DSN=T12345.FILE2.PS: Name of the second dataset to compare.

    • SYSIN DD:

      • COMPARE TYPORG=PS: Specifies the comparison type as PS (physical sequential dataset).

      • If COMPARE TYPORG=PO: Then it specifies the comparison type is PO (partitioned data sets)

    If no difference found in SYSUT1 and SYSUT2 then return code is 0 if difference is found then return code is 8

    //IEBCOMPR JOB (12345),CLASS=A,MSGCLASS=X,NOTIFY=&SYSUID
    //STEP1 EXEC PGM=IEBCOMPR 
    //SYSUT1 DD DSN=T12345.FILE1.PS, DISP=SHR 
    //SYSUT2 DD DSN=T12345.FILE2.PS.DISP=SHR 
    //SYSPRINT DD SYSOUT=* 
    //SYSOUT DD SYSOUT=* 
    //SYSIN DD * 
       COMPARE TYPORG=PS 
    /* 
    //

    IEBCOPY Exclude members while copying

    EXAMPLE:

    Exclude Members While Copying PDS

    //IEBCOPY  JOB (12345),CLASS=A,MSGCLASS=X,NOTIFY=&SYSUID  
    //STEP1    EXEC PGM=IEBCOPY  
    //SYSPRINT DD SYSOUT=*  
    //SYSUT1   DD DSN=T12345.SOURCE.PDS,DISP=SHR  
    //SYSUT2   DD DSN=T12345.TARGET.PDS,DISP=SHR  
    //SYSIN    DD *  
      COPY OUTDD=SYSUT2,
      INDD=SYSUT1  
      EXCLUDE MEMBER=TEMP1,OLDPGM 
    /*  

    Explanation:

    EXEC Statement: Executes the IEBCOPY utility to copy members from one PDS to another, excluding specific ones.

    DD Statement:

    SYSUT1 DD: Specifies the input PDS (T12345.SOURCE.PDS) that contains all the members.

    SYSUT2 DD: Specifies the output PDS (T12345.TARGET.PDS) where the members will be copied, except the excluded ones.

    SYSPRINT DD: Outputs logs and messages related to the copy process.

    SYSIN DD: Contains the control statements:

    • COPY INDD=SYSUT1,OUTDD=SYSUT2: initiates the copy operation.

    • EXCLUDE MEMBER=TEMP ,OLDPGM: tell IEBCOPY to skip copying these specific members.

    This JCL copies all members from the source PDS to the target PDS except the ones explicitly excluded (TEMP1 and OLDPGM). It’s helpful when you want to copy almost everything but leave out outdated or unnecessary members