GENERATE Statement


The GENERATE statement should be coded as the first statement in IEBGENER utility statements. The GENERATE statement is required when -

  • The output dataset is partitioned.
  • Performs editing.
  • Providing user routines.
  • Specifying the label processing.

Syntax -

//SYSIN DD *
  GENERATE [MAXNAME=n][,MAXFLDS=n][,MAXGPS=n][,MAXLITS=n]
/*

Parameters -

KeywordDescription
MAXNAME=n It is required if one or more MEMBER statements coded. 'n' specifies a number from 1 to 3276.
MAXFLDS=n It is required if any FIELD parameters coded in subsequent RECORD statements. 'n' specifies a number from 1 to 4095.
MAXGPS=n It is required if any IDENT parameters coded in subsequent RECORD statements. 'n' specifies a number from 1 to 2520.
MAXLITS=n It is required if the FIELD parameters of subsequent RECORD statements contain literal. 'n' specifies a number from 1 to 2730.
DBCS={YES|NO}Specifies if the input data set contains double-byte character set data.

Practical Example -


Scenario - Copy sequential file records upto 'E0005' into a PDS member (PDS is already created).

Input PS File - MATEPK.IEBGENER.INPUTPS

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
E0001    EMPLOYEE1           DIR                 LOC1      0000100000    
E0002    EMPLOYEE2           MGR       DEPT1     LOC1      0000080000    
E0003    EMPLOYEE3           MGR       DEPT2     LOC2      0000075000    
E0004    EMPLOYEE4           TL        DEPT1     LOC1      0000050000    
E0005    EMPLOYEE5           SSE       DEPT1     LOC1      0000045000    
E0006    EMPLOYEE6           SE        DEPT1     LOC1      0000034000    
E0007    EMPLOYEE7           SSE       DEPT2     LOC2      0000046000    
******************************** Bottom of Data ********************************

Code -

----+----1----+----2----+----3----+----4----+----5----+----6----+
//MATEPKG  JOB (123),'MTH',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),
//             NOTIFY=&SYSUID
//***************************************************************
//* SPLIT THE SEQUENTIAL FILE RECORDS INTO DIFFERENT PDS MEMBERS
//***************************************************************
//STEP10   EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1   DD DSN=MATEPK.IEBGENER.INPUTPS,DISP=SHR
//SYSUT2   DD DSN=MATEPK.IEBGENER.OUTPDS,DISP=OLD 
//SYSIN    DD  *
  GENERATE MAXNAME=1,MAXGPS=1
    MEMBER NAME=MEMBER4
    RECORD IDENT=(5,'E0005',1)
/*

JOB Output -

 COMMAND INPUT ===>                                            SCROLL ===> CSR  
********************************* TOP OF DATA **********************************
DATA SET UTILITY - GENERATE                                                     
  GENERATE MAXNAME=1,MAXGPS=1                                                   
    MEMBER NAME=MEMBER4                                                         
    RECORD IDENT=(5,'E0005',1)                                                  
 
PROCESSING ENDED AT LAST REC ID                                                 
******************************** BOTTOM OF DATA ********************************

Output - MATEPK.IEBGENER.OUTPDS

VIEW       MATEPK.IEBGENER.OUTPDS(MEMBER4) - 01.00       Columns 00001 00072 
Command ===>                                                  Scroll ===> CSR  
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
****** ***************************** Top of Data ******************************
000001 E0001    EMPLOYEE1           DIR                 LOC1      0000100000   
000002 E0002    EMPLOYEE2           MGR       DEPT1     LOC1      0000080000   
000003 E0003    EMPLOYEE3           MGR       DEPT2     LOC2      0000075000   
000004 E0004    EMPLOYEE4           TL        DEPT1     LOC1      0000050000   
000005 E0005    EMPLOYEE5           SSE       DEPT1     LOC1      0000045000   
****** **************************** Bottom of Data ****************************

Explaining Example -

  • SYSUT1 DD maps the input data set (MATEPK.IEBGENER.INPUTPS).
  • SYSUT2 DD defines the output partitioned data set (MATEPK.IEBGENER.OUTPDS).
  • SYSIN DD defines the control data set.
  • GENERATE MAXNAME=1,MAXGPS=1 indicates a maximum of one names and on IDENTs are included in subsequent MEMBER statements.
  • MEMBER NAME=MEMBER1 names the first member as MEMBER1.
  • RECORD IDENT=(5,'E0005',1) copies the records upto 'E0005' from the beginning to MEMBER1.