IEBGENER Tutorial- Quick reference with examples

IEBGENER Quick Guide with examples

IEBGENER is used as a copy utility in mainframes area. It works to copy PS to PS, PDS member to PS, PDS member to another PDS member etc. It also has the options to filter and modify the data.

SYSUT1 –> mandatory and data set given here is used as input data set
SYSUT2 –> Mandatory and this is the output data set
SYSPRINT–> mANDATORY and used to display the messages
SYSIN –> Mandatory & control statements are given here. If there are no control statements, DUMMY can be specified.

Examples of IEBGENER.

A simple copy JOB to copy one PS to another.

//STEP02 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=A
//SYSIN DD DUMMY
//SYSUT1 DD DSN=TEST.IEBGNR.IN.FILE,DISP=OLD
//SYSUT2 DD DSN=TEST.IEBGNR.OUT.FILE,DISP=(NEW,CATLG,DELETE),
// UNIT=PROD1,SPACE=(CYL,(5,5)),
// DCB=(RECFM=FB,LRECL=110,BLKSIZE=1100)

Here DCB parameter can be excluded. If supplied it should be same as the input file. If we change the length of output file
it throws an error “IEB311I CONFLICTING DCB PARAMETER:. But to avoid this error , additional control statements needs to be put in SYSIN.

Copy part of the data from input to output by inserting few literals

Input file:
—-+—-1—-+—-2—-+—-3—-+—-4—-+—-5—-
***************************** Top of Data *********************
0001MAHENDER REDDY HYDERABAD DEVELOPER INDIA
0002RAGHAV RAJ PUNE LEAD INDIA
0003SHREYANSHREDDY MUMBAI ARCHITECT INDIA
0004VISHU CHENNAI MANAGER INDIA

Here I need only Name(5 to 19) and his designation(30 to 38 ) and in between these two I need an arrow symbol

001910 //SYSIN DD *
001920 GENERATE MAXFLDS=3,MAXLITS=5
002010 RECORD FIELD=(15,5,,1),
002011 FIELD=(4,’–> ‘,,16),
002012 FIELD=(9,30,,20)
002020 /*
002100 //

  • 1st Record Filed indicates that 1st position in output file should be filled with the 5 to 19 (15 length) of input file.
  • 2nd record field indicates that starting from 16th position of output file should be filled with a 4 character literal ‘–>’ .
  • 3rd one states that starting from 20th position of output file should be filled with 30 to 38(9 in length) of input file.

After running the job output looks like below

—-+—-1—-+—-2—-+—-3—-+—-4
***************************** Top of Data
MAHENDER REDDY –> DEVELOPER
RAGHAV RAJ –> LEAD
SHREYANSHREDDY –> ARCHITECT
VISHU –> MANAGER

In this case output file LRECL can differ from the input file as record field statements have been included.When creating an
output data set that has differs in LRECL from Input dataset, specification must be there on where each byte in the output
records is to come from.

Creating a PDS member from a PS.

//STEP03 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=A
//SYSUT1 DD DSN=TEST.IEBGNR.IN.FILE,DISP=OLD
//SYSUT2 DD DSN=TEST.IEBGNR.OUT.PDS,DISP=OLD
//SYSIN DD *
GENERATE MAXFLDS=4,MAXLITS=99,MAXNAME=1
MEMBER NAME=OUT2
RECORD FIELD=(15,5,,1),
FIELD=(4,’–> ‘,,16),
FIELD=(9,30,,20)
/*

Like above multiple PDS members can be created. But Invalid space allocation error comes when MAXNAME field is not given or
its value is not less than the actual members given.

Creating Empty Dataset:

Empty data set can be created by using this utility. Below is the example job.
By default it takes the DCB parameters from the DUMMY data set and creates a file with LRECL of 5 with U as the record format.

//*CREATIGN EMPTY DATA SET
//STEP05 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=A
//SYSUT1 DD DUMMY
//SYSUT2 DD DSN=PRT.TST.OUT.EMPTY,DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,SPACE=(CYL,(11,5))
//SYSIN DD DUMMY
//

Creating Empty data set with desired LRECL and DCB parameters

//*CREATIGN EMPTY DATA SET WITH DESRIRED LRECL
//STEP06 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=A
//SYSUT1 DD DUMMY,DCB=(RECFM=FB,LRECL=80,BLKSIZE=8000)
//SYSUT2 DD DSN=PRT.TST.OUT.EMPT1,DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,SPACE=(CYL,(5,2))
//SYSIN DD DUMMY
//

Check for the common errors in IEBGENER @ http://www.techtricky.com/iebgener-invalid-space-allocation-error/

Leave a Reply

Your email address will not be published. Required fields are marked *

Bitnami