Example 5: Create Records in Three Output Data Sets and Write them to Three Partitioned Data Set Members
Restriction: This example will not work if the data sets are
system-managed or SMS data sets.
`
In this example, output records are created from three sets of utility control statements and written in three members in one partitioned data set. Four fields are created and used in the construction of the output records. In two of the fields (FIELD1 and FIELD3), alphabetic data is shifted. FIELD2 is fixed zoned decimal and FIELD4 is fixed alphanumeric. Figure 1 shows the partitioned data set members at the end of the job step.
//UTSTS JOB ...
//STEP1 EXEC PGM=IEBDG
//SYSPRINT DD SYSOUT=A
//PAROUT1 DD DSNAME=PARSET(MEMBA),UNIT=disk,DISP=(,KEEP),
// VOLUME=SER=111111,SPACE=(TRK,(10,10,5)),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)
//PAROUT2 DD DSNAME=PARSET(MEMBB),UNIT=AFF=PAROUT1,
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)
// DISP=OLD,VOLUME=SER=111111
//PAROUT3 DD DSNAME=PARSET(MEMBC),UNIT=AFF=PAROUT1,
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)
// DISP=OLD,VOLUME=SER=111111
//SYSIN DD DATA
DSD OUTPUT=(PAROUT1)
FD NAME=FIELD1,LENGTH=30,FORMAT=AL,ACTION=SL
FD NAME=FIELD2,LENGTH=20,FORMAT=ZD
FD NAME=FIELD3,LENGTH=20,FORMAT=AL,ACTION=SR
FD NAME=FIELD4,LENGTH=30,FORMAT=AN
CREATE QUANTITY=4,NAME=(FIELD1,FIELD3,FIELD2)
END
DSD OUTPUT=(PAROUT2)
CREATE QUANTITY=4,NAME=(FIELD2,(COPY=3,FIELD3))
END
DSD OUTPUT=(PAROUT3)
CREATE QUANTITY=4,NAME=(FIELD4,FIELD1)
END
/*
The control statements are as follows:
- PAROUT1 DD defines the first member (MEMBA) of the partitioned output data set. This example assumes that the partitioned data set does not exist before this job step; that is, this DD statement allocates space for the data set.
- PAROUT2 and PAROUT3 DD define the second and third members, respectively, of the output partitioned data set. Note that each DD statement specifies DISP=OLD and UNIT=AFF=PAROUT1.
- SYSIN DD defines the control data set that follows in the input stream.
- DSD marks the beginning of a set of utility control statements and refers to the DD statement defining the member applicable to that set of utility control statements.
- FD defines the contents of a field that is used in the subsequent construction of output records.
- CREATE constructs four records from combinations of previously defined fields.
- END signals the end of a set of utility control statements.