In this example, a sequential input data set is edited and copied.
//TAPETAPE JOB ...
//STEP1 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=A
//SYSUT1 DD DSNAME=OLDSET,UNIT=tape,DISP=(OLD,KEEP),
// VOLUME=SER=001234,LABEL=(3,SUL)
//SYSUT2 DD DSNAME=NEWSET,UNIT=tape,DISP=(NEW,PASS),
// DCB=(RECFM=FB,LRECL=80),
// VOLUME=SER=001235,LABEL=(,SUL)
//SYSIN DD *
GENERATE MAXFLDS=3,MAXLITS=11
RECORD FIELD=(10,'**********',,1),
FIELD=(5,1,HE,11),FIELD=(1,'=',,16)
EXITS INHDR=ROUT1,OUTTLR=ROUT2
LABELS DATA=INPUT
RECORD LABELS=2
(first header label record)
(second header label record)
RECORD LABELS=2
(first trailer label record)
(second trailer label record)
/*
The control statements are as follows:
- SYSUT1 DD defines the sequential input data set (OLDSET). The
data set was originally written as the third data set on a tape volume.
- SYSUT2 DD defines the sequential output data set (NEWSET). The
data set is written as the first data set on a tape volume. The output
records are blocked to reduce the space required by the data set and
to reduce the access time required when the data set is subsequently
referred to. The BLKSIZE parameter is omitted so that the system will
calculate an optimal value that is less than or equal to 32␠760
bytes unless the system programmer sets the default differently. The
data set is passed to a subsequent job step. The LABEL=(,SUL) is required
because of the user labels created.
- SYSIN DD defines the control data set, which follows in the input
stream.
- GENERATE indicates that a maximum of three FIELD parameters is
included in subsequent RECORD statements and that a maximum of 11
literal characters are included in subsequent FIELD parameters.
- The first RECORD statement controls the editing, as follows:
asterisks are placed in positions 1 through 10; positions 1 through
5 of the input record are converted from H-set BCDIC to EBCDIC mode
and moved to positions 11 through 15; and an equal sign is placed
in position 16.
- EXITS indicates that the specified user routines require control
when SYSUT1 is opened and when SYSUT2 is closed.
- LABELS indicates that labels are included in the input stream.
- The second RECORD statement indicates that the next two records
from SYSIN should be written out as user header labels on SYSUT2.
- The third RECORD statement indicates that the next two records
from SYSIN should be written as user trailer labels on SYSUT2.
This example shows the relationship between the RECORD LABELS statement,
the LABELS statement, and the EXITS statement. IEBGENER tries to write
a first and second label trailer as user labels at close time of SYSUT2
before returning control to the system; the user routine, ROUT2, can
review these records and change them, if necessary.
Related reading: For more information, see EXEC Statement.