IEBGENER Utility


IEBGENER is a utility program in IBM Mainframe systems, particularly under z/OS. It is primarily used for copying and converting data sets, including sequential files, partitioned datasets, and generation data groups.

It can convert and copy sequential file data to PDS members and PDS member data to sequential files. The copy operation can be performed on all types of records having various lengths (including record length > 32760 bytes).

It uses either a sequential file or PDS or PDSE member as input and a new or existing sequential file or a PDS or PDSE member as output.

Usage -


Below is the list of tasks that IEBGENER can perform -

  • Copying Data Sets - It can copy one data set to another. It's often used for backing up data, creating duplicates, or moving data from one location to another.
  • Creating and Modifying Data Sets - It can create new data sets with specific attributes or modify existing ones, such as changing record formats or lengths.
  • Dataset Conversion - Converts between different data set formats, like from fixed to variable length.
  • Print Formatting - It can be used to format data for printing.
  • Dataset Concatenation - Combines multiple datasets into a single dataset.
Note! If the DFSORT product is installed in the Mainframe environment. In that case, ICEGENER can be an alternative to IEBGENER when creating an unedited copy of a data set or PDS or PDSE member.

Return Codes -


IEBGENER returns a code to specifies the program execution results. The return codes and their meanings are -

CodesMeaning
00 (X'00')Successful completion.
04 (X'04')Successful completion with a warning message.
08 (X'08')Either processing abnormally ended after requesting to process user header labels only, or a DBCS error was encountered.
12 (X'0C')An unrecoverable error exists, or a DBCS error was encountered.
Job execution gets stopped when an error occurs.
16 (X'10')A user specified return code.
The utility execution ends.

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
...

Want to Learn More?


If you want to learn more about IEBGENER utility, go through the below topics explained with examples -