Control Statements (for Beginners)
Summary
For extensive information, go through the Control Statements (for Experienced)
IEBGENER utility has two types of statements to perform the task, and those are -
- Job Control Statements
- Utility Control Statements
Job Control Statements -
The job control statements are required to run IEBGENER to complete the task. Those are -
Statement | Usage |
---|---|
JOB | Starts JOB execution. |
EXEC | Starts executing the IEBGENER utility. |
SYSPRINT DD | This is a mandatory data set and used for listing control statements and messages. |
SYSUT1 or anyname1 DD | This is a mandatory data set and defines a PDS or unload data set for input. |
SYSUT2 or anyname2 DD | This is a mandatory data set and defines a PDS or unload data set for output. |
SYSUT3 DD | This is a optional temp data set and used when there is no space in virtual storage for some or all of the current input data set directory entries. |
SYSUT4 DD | This is a optional temp data set and is used when there is no space in virtual storage for the output data set directory. |
SYSIN DD | The mandatory control data set and used to code utility control statements are optional. |
Utility Control Statements -
IEBGENER also has its own control statements and it control the functions of IEBGENER. If no utility control statements are included, the entire input data set gets copied sequentially.
The IEBGENER utility control statements are -
- GENERATE
- RECORD
- MEMBER
- EXITS
- LABELS
GENERATE Statement
The GENERATE statement should appear as the first statement in IEBGENER utility statements. The GENERATE statement is required when -
- The output dataset is partitioned (PDS).
- Performs editing.
- Providing user routines.
- Specifying the label processing.
Syntax -
//SYSIN DD *
GENERATE [MAXNAME=n][,MAXFLDS=n][,MAXGPS=n][,MAXLITS=n]
/*
Parameters -
Keyword | Description |
---|---|
MAXNAME=n | MAXNAME is required if one or more MEMBER statements coded. |
MAXFLDS=n | MAXFLDS is required if any FIELD parameters coded in subsequent RECORD statements. |
MAXGPS=n | MAXGPS is required if any IDENT parameters coded in subsequent RECORD statements. |
MAXLITS=n | MAXLITS is required if the FIELD parameters of subsequent RECORD statements contain literal. |
Example -
Requirement - 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----+----7--
***************************** Top of Data ******************************
//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)
/*
**************************** 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 ****************************
RECORD Statement
The RECORD statement defines a record group to supply editing information. A record group consists of records that are to be processed identically.
Syntax -
//SYSIN DD *
RECORD [{IDENT|IDENTG}=(length,'name',input-location)]
[,FIELD=([length],[{input-location|'literal'}],[conversion],[output-location])]
[,FIELD=...][,LABELS=n]
/*
Parameters -
Keyword | Description |
---|---|
IDENT|IDENTG}= (length,'name',input-location) | Identifies the last record the input data set from group of record. |
FIELD=([length], [{input-location| 'literal'}], [conversion],[output-location]) | Specifies field-processing and editing information. |
LABELS=n | It is an optional parameter that specifies the number of records in the SYSIN data set to be treated as user labels. |
Example -
Requirement - Split sequential file records into three PDS members along with PDS creation. The newly created members are merged into an existing partitioned data set.
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----+----7--
***************************** Top of Data ******************************
//MATEPKR JOB (123),'MTH',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),
// NOTIFY=&SYSUID
//**********************************************************************
//* ADD '=====' BEFORE AND AFTER THE DATA
//**********************************************************************
//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)
/*
**************************** Bottom of Data ****************************
Output - MATEPK.IEBGENER.OUTPUTPS
BROWSE MATEPK.IEBGENER.OUTPUTPS Line 00000000 Col 001 080
Command ===> Scroll ===> CSR
----+----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 ********************************
MEMBER Statement
MEMBER statement specifies the member name or member alias of a output PDS or PDSE.
Syntax -
//SYSIN DD *
MEMBER NAME=(name[,alias 1][,alias 2][,...])
/*
Parameters -
- NAME=(name[,alias][,...]) -Specifies a member name and its aliases.
Example -
Requirement - Split sequential file records into a PDS member along with PDS creation.
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----+----7--
***************************** Top of Data ******************************
//MATEPKM JOB (123),'MTH',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),
// NOTIFY=&SYSUID
//**********************************************************************
//* COPY SEQUENTIAL FILE DATA TO PDS MEMBER
//**********************************************************************
//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
MEMBER NAME=MEMBER5
/*
**************************** Bottom of Data ****************************
Output - MATEPK.IEBGENER.OUTPDS
VIEW MATEPK.IEBGENER.OUTPDS(MEMBER5) - 01.00 Columns 00001 00072
Command ===> Scroll ===> CSR
****** ***************************** 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
000006 E0006 EMPLOYEE6 SE DEPT1 LOC1 0000034000
000007 E0007 EMPLOYEE7 SSE DEPT2 LOC2 0000046000
****** **************************** Bottom of Data ****************************
EXITS Statement
The EXITS statement is used to identify exit routines IEBGENER to use.
Syntax -
//SYSIN DD *
EXITS [INHDR=routinename][,OUTHDR=routinename]
[,INTLR=routinename][,OUTTLR=routinename]
[,KEY=routinename][,DATA=routinename]
[,IOERROR=routinename][,TOTAL=(routinename,size)]
/*
Parameters -
Keyword | Description |
---|---|
INHDR=routine-name | Specifies the name of the user header routine (input). |
OUTHDR=routine-name | Specifies the name of the user header routine (output) that creates. |
INTLR=routine-name | Specifies the name of the user trailer routine (input). |
OUTTLR=routine-name | Specifies the name of the user trailer routine that processes (output). |
KEY=routine-name | Specifies the name of the output record key routine. |
DATA=routine-name | Specifies the name of the physical record routine that modifies before IEBGENER processes it. |
IOERROR=routine-name | Specifies the routine's name that handles permanent input/output error conditions. |
TOTAL=(routine-name,size) | Specifies that a user exit routine is to be provided before writing each record. |
routine-name | Specifies the name of the totalling routine. |
size | Specifies totals, counters, pointers and so forth. |
Example -
Requirement - Split sequential file records into three PDS members along with PDS creation. The newly created members are merged into an existing partitioned data set.
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----+----7--
***************************** Top of Data ******************************
//MATEPKE 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=(NEW,CATLG,DELETE),
// SPACE=(TRK,(10,10,10),RLSE),
// VOL=SER=DEVHD4,UNIT=3390,
// DCB=(DSORG=PO,RECFM=FB,LRECL=80,BLKSIZE=800)
//SYSIN DD *
GENERATE MAXNAME=3,MAXGPS=2
EXITS IOERROR=ERRORRT
MEMBER NAME=MEMBER1
RECORD IDENT=(5,'E0003',1)
MEMBER NAME=MEMBER2
RECORD IDENT=(5,'E0005',1)
MEMBER NAME=MEMBER3
/*
**************************** Bottom of Data ****************************
Output - MATEPK.IEBGENER.OUTPDS
VIEW MATEPK.IEBGENER.OUTPDS(MEMBER1) - 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
****** **************************** Bottom of Data ****************************
VIEW MATEPK.IEBGENER.OUTPDS(MEMBER1) - 01.00 Columns 00001 00072
Command ===> Scroll ===> CSR
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
****** ***************************** Top of Data ******************************
000004 E0004 EMPLOYEE4 TL DEPT1 LOC1 0000050000
000005 E0005 EMPLOYEE5 SSE DEPT1 LOC1 0000045000
****** **************************** Bottom of Data ****************************
VIEW MATEPK.IEBGENER.OUTPDS(MEMBER1) - 01.00 Columns 00001 00072
Command ===> Scroll ===> CSR
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
****** ***************************** Top of Data ******************************
000006 E0006 EMPLOYEE6 SE DEPT1 LOC1 0000034000
000007 E0007 EMPLOYEE7 SSE DEPT2 LOC2 0000046000
****** **************************** Bottom of Data ****************************
LABELS Statement
The LABELS statement is used to decide whether the labels are to copied or not to the output data set. All but the last statements are ignored if more than one valid LABELS statement is coded.
Syntax -
//SYSIN DD *
LABELS [DATA={YES|NO|ALL|ONLY|INPUT}]
/*
Parameters -
Keyword | Description |
---|---|
DATA=YES | Specifies any user labels are required to treat as data. YES is the default. |
DATA=NO | Specifies user labels are not required to treat as data. |
DATA=ALL | Specifies that all user labels in the current processing group are required to treat as data. |
DATA=ONLY | Specifies only user header labels are required to treat as data. |
DATA=INPUT | Specifies user labels for the output data set are coded as 80-byte input records in the data portion of SYSIN. |
Example -
Requirement - Edit and Copy a Sequential Input Data Set with Labels
Input PS File - MATEPK.IEBGENER.INPUTPS1
BROWSE MATEPK.IEBGENER.INPUTPS1 Line 00000000 Col 001 080
Command ===> Scroll ===> CSR
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
.A EMPLOYEE DETAILS
.B EMPNO EMPNAME DESGN DEPTNAME LOCATION SALARY
.C******************************************************************************
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
.D******************************************************************************
.E TOTAL EMPLOYEES: 7
******************************** Bottom of Data ********************************
Code -
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
***************************** Top of Data ******************************
//MATEPKL JOB (123),'MTH',CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1),
// NOTIFY=&SYSUID
//**********************************************************************
//* EDIT AND COPY A SEQUENTIAL INPUT DATA SET WITH LABELS
//**********************************************************************
//STEP10 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=MATEPK.IEBGENER.INPUTPS1,DISP=SHR
//SYSUT2 DD DSN=MATEPK.IEBGENER.OUTPUTL,
// 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)
LABELS DATA=INPUT
RECORD LABELS=3
.A .B .C
RECORD LABELS=2
.D .E
/*
**************************** Bottom of Data ****************************
Output - MATEPK.IEBGENER.OUTPUTL
BROWSE MATEPK.IEBGENER.OUTPUTL Line 00000000 Col 001 080
Command ===> Scroll ===> CSR
----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8
********************************* Top of Data **********************************
=====.A EMPLOYEE DETAILS =====
=====.B EMPNO EMPNAME DESGN DEPTNAME LOCATION SALARY =====
=====.C********************************************************************=====
===== E0001 EMPLOYEE1 DIR LOC1 000010000=====
===== E0002 EMPLOYEE2 MGR DEPT1 LOC1 000008000=====
===== E0003 EMPLOYEE3 MGR DEPT2 LOC2 000007500=====
===== E0004 EMPLOYEE4 TL DEPT1 LOC1 000005000=====
===== E0005 EMPLOYEE5 SSE DEPT1 LOC1 000004500=====
===== E0006 EMPLOYEE6 SE DEPT1 LOC1 000003400=====
===== E0007 EMPLOYEE7 SSE DEPT2 LOC2 000004600=====
=====.D********************************************************************=====
=====.E TOTAL EMPLOYEES: 7 =====
******************************** Bottom of Data ********************************