GENERATE Statement


The GENERATE statement can be used while copying and reformatting data during copying. It is coded when output is partitioned, editing is performed, or 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 Specifies the no of FIELD parameters coded in subsequent RECORD statements. 'n' specifies a number from 1 to 4095.
MAXGPS=n Specifies no of IDENT parameters coded in subsequent RECORD statements. 'n' specifies a number from 1 to 2520.
MAXLITS=n Specifies no of FIELD parameters of subsequent RECORD statements contain literal. 'n' specifies a number from 1 to 2730.

Practical Example -


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

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.OUTPDS,DISP=OLD 
//SYSIN    DD  *
  GENERATE MAXNAME=1,MAXGPS=1
    MEMBER NAME=MEMBER4
    RECORD IDENT=(5,'E0005',1)
/*
...