EXITS Statement
EXITS Statement (for Experienced)
Summary
For basic information, go through the Control Statements (for Beginners)
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 ****************************
JOB Status -
COMMAND INPUT ===> SCROLL ===> CSR
********************************* TOP OF DATA **********************************
DATA SET UTILITY - GENERATE
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
PROCESSING ENDED AT EOD
******************************** 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 ****************************
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=3,MAXGPS=2 indicates a maximum of three names and two IDENTs are included in subsequent MEMBER statements.
- EXITS IOERROR=ERRORRT define the user routines to process user label for the IOERROR.
- MEMBER NAME=MEMBER1 names the first member as MEMBER1.
- RECORD IDENT=(5,'E0003',1) copies the records upto 'E0003' from the beginning to MEMBER1.
- MEMBER NAME=MEMBER2 names the second member as MEMBER2.
- RECORD IDENT=(5,'E0005',1) copies the records after 'E0003' until 'E0005' to MEMBER2.
- MEMBER NAME=MEMBER2 names the third member as MEMBER3 and copies the records after 'E0005' until end because no RECORD IDENT statement coded.