Performing Tasks


Creating a Backup Copy -


IEBGENER is used to create a backup copy of a sequential file (PS) to another. It can copy the entire data set to another file on disk, tape etc.

Example -

Scenario - Create flat (PS) file backup.

JCL -

----+----1----+----2----+----3----+----4----+----5----+
...
//STEP10   EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1   DD DSN=MATEPK.IEBGENER.INPUTPS,DISP=SHR
//SYSUT2   DD DSN=MATEPK.IEBGENER.BACKUPPS,
//            DISP=(NEW,CATLG,DELETE),
//            SPACE=(TRK,(10,10),RLSE),
//            UNIT=3390,VOL=SER=DEVHD4,
//            DCB=(DSORG=PS,RECFM=FB,LRECL=80,BLKSIZE=800)
//SYSIN    DD  DUMMY
...

Changing Logical Record Length -


IEBGENER is used to produce a reblocked output file. The output file can contain either fixed-length or variable-length records that is different from input record length. Any fields that are not coded may contain unpredictable data.

Example -

Scenario - Create new PS file with length 70 different input file length 80.

Input PS File - MATEPK.IEBGENER.INPUTPS

JCL -

----+----1----+----2----+----3----+----4----+----5----+----6
...
//STEP10   EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1   DD DSN=MATEPK.IEBGENER.INPUTPS,DISP=SHR
//SYSUT2   DD DSN=MATEPK.IEBGENER.OUTPUTPS,
//            DISP=(NEW,CATLG,DELETE),
//            SPACE=(TRK,(10,10),RLSE),
//            UNIT=3390,VOL=SER=DEVHD4,
//            DCB=(DSORG=PS,RECFM=FB,LRECL=70,BLKSIZE=700)
//SYSIN    DD  *
  GENERATE MAXFLDS=1
    RECORD FIELD=(70,1,,1)
/*
...

Creating a PDS from Sequential File Input -


IEBGENER can logically divide a sequential data set into record groups and creates members with the record groups. It places the newly created members in an output PDS or PDSE. IEBGENER can’t create a PDS or PDSE if an input or output data set contains spanned records.

Example -

Scenario - Create PDS member from PS file.

Code -

----+----1----+----2----+----3----+----4----+----5----+----6
...
//STEP10   EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1   DD DSN=MATEPK.IEBGENER.INPUTPS,DISP=SHR
//SYSUT2   DD DSN=MATEPK.IEBGENER.NEWPDS(BACKUPPS),
//            DISP=(NEW,CATLG,DELETE),
//            SPACE=(TRK,(10,10),RLSE),
//            UNIT=3390,VOL=SER=DEVHD4,DSNTYPE=LIBRARY,
//            DCB=(DSORG=PO,RECFM=FB,LRECL=80,BLKSIZE=800)
//SYSIN    DD  DUMMY
...

Print PS file data -


IEBGENER can use to print the contents of a sequential file (PS file) to a printer or to the system's spool. This is a common operation for reviewing or debugging data in a sequential file, especially in batch-processing environments.

Example -

Scenario - Print the contents of a PS file to a system spool.

Input PS File - MATEPK.IEBGENER.INPUTPS

JCL -

----+----1----+----2----+----3----+----4----+----5----+
...
//PRINTPS  EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1   DD DSN=MATEPK.IEBGENER.INPUTPS,DISP=SHR
//SYSUT2   DD SYSOUT=*
//SYSIN    DD DUMMY
...

Copy file from Tape to Disk -


Copying a file from tape to disk is common in mainframe environments. Data is archived on tape and later retrieved to disk for processing or analysis. In this operation, the tape dataset is used as the input (SYSUT1), and the disk dataset is used as the output (SYSUT2). Tape datasets require specific handling, such as specifying the UNIT as TAPE and providing a tape label identifier (LABEL) if necessary.

Example -

Scenario - Copy a dataset from a tape volume to a new file on disk.

Input PS File on tape - MATEPK.IEBGENER.INPTAPE

JCL -

----+----1----+----2----+----3----+----4----+----5----+
...
//STEP10   EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1   DD DSN=MATEPK.IEBGENER.INPTAPE,
//            UNIT=TAPE,LABEL=(,SL),DISP=SHR
//SYSUT2   DD DSN=MATEPK.IEBGENER.OUTPS,
//            DISP=(NEW,CATLG,DELETE),
//            SPACE=(TRK,(10,10),RLSE),
//            VOL=SER=DEVHD4,UNIT=3390
//SYSIN    DD DUMMY
...

Copy data by inserting literals -


IEBGENER can insert literal values or fixed text into the copied data. This feature is useful when we need to add constant data, such as headers, footers, or markers, during the copy process.

Example -

Scenario - Insert the literal "=====" in the place of 1-5 or 75-80 characters

Input PS File - MATEPK.IEBGENER.INPUTPS

JCL -

----+----1----+----2----+----3----+----4----+----5----+
...
//STEP10   EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1   DD DSN=MATEPK.IEBGENER.INPUTPS,DISP=SHR
//SYSUT2   DD DSN=MATEPK.IEBGENER.OUTPUTPS,
//            DISP=(NEW,CATLG,DELETE),
//            SPACE=(TRK,(10,10),RLSE),
//            UNIT=3390,VOL=SER=DEVHD4,
//            DCB=(DSORG=PS,RECFM=FB,LRECL=80,BLKSIZE=800)
//SYSIN    DD  *
  GENERATE MAXFLDS=3,MAXLITS=10
    RECORD FIELD=(5,'=====',,1),
           FIELD=(70,1,,6),
           FIELD=(5,'=====',,76)
/*
...

Copy Unix file to PS file -


IEBGENER is used to copy z/OS unix file to PS file by coding the appropriate file paths and dataset names in the JCL. UNIX System Services (USS) provides a POSIX-compliant environment where UNIX files are stored in a hierarchical file system (HFS) or z/OS File System (zFS).

Example -

Scenario - Edit and Copy a Sequential z/OS UNIX file to a PS file.

JCL -

----+----1----+----2----+----3----+----4----+----5----+----6
...
//STEP10   EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1   DD PATH='/mth9/input1/trans.mon',
//            FILEDATA=TEXT,PATHOPTS=ORDONLY,
//            DCB=(LRECL=90,BLKSIZE=900,RECFM=FB)
//SYSUT2   DD DSN=MATEPK.IEBGENER.OUTPUTPS,
//            DISP=(NEW,CATLG,DELETE),
//            SPACE=(TRK,(10,10),RLSE),
//            UNIT=3390,VOL=SER=DEVHD4,
//            DCB=(DSORG=PS,RECFM=FB,LRECL=90,BLKSIZE=900)
//SYSIN    DD DUMMY
...