References to concatenated data sets
If you make a backward reference to a concatenation (using *.), the system obtains information only from the first data set defined in the sequence of DD statements.
If you make a forward reference to a concatenation
(using the DDNAME parameter), the forward reference resolves to the
first data set in the concatenation. If there are no DD statements
between the forward reference and the concatenation, the rest of the
data sets in the concatenation are appended to the first data set
in the concatenation. The following example illustrates this.
//STEP1 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DDNAME=INPUT
//INPUT DD DSN=TSTDATA1,DISP=SHR
// DD DSN=TSTDATA2,DISP=SHR
//SYSUT2 DD SYSOUT=*
//SYSIN DD DUMMY
In this example, SYSUT1 will resolve to the first data set, TSTDATA1, defined by the DDNAME forward reference INPUT. TSTDATA2, the second data set in the DDNAME forward reference INPUT, will be appended to SYSUT1 as well. IEBGENER will recognize TSTDATA1 and TSTDATA2 as input.
If there are any DD statements between the forward reference and
the concatenation, the rest of the data sets in the concatenation
are appended to the last DD statement preceding the concatenation.
For example:
//STEP1 EXEC PGM=IEBGENER
//SYSUT1 DD DDNAME=INPUT
//SYSPRINT DD SYSOUT=*
//SYSUT2 DD SYSOUT=*
//INPUT DD DSN=TSTDATA1,DISP=SHR
// DD DSN=TSTDATA2,DISP=SHR
//SYSIN DD DUMMY
In the preceding example, SYSUT1 will resolve to the first data set, TSTDATA1, defined in the DDNAME forward reference INPUT. TSTDATA2 will be appended to SYSUT2, the last DD statement preceding the concatenation. In this example, IEBGENER will recognize only TSTDATA1 as input.
If a concatenated DD is added to a procedure, the remaining concatenated
data sets will be concatenated to the last DD in the step named in
an override or addition (or to the first step if no step was named
in an override or addition). Note that this may result in these concatenated
DDs being added to an unexpected DD. The following example illustrates
this.
//TPROC PROC
//S1 EXEC PGM=IEFBR14
//DD1 DD DDNAME=INPUT
//DD2 DD DSN=MYDSN2,DISP=SHR
//DD3 DD DSN=MYDSN3,DISP=SHR
//S2 EXEC PGM=IEFBR14
//DDA DD DDNAME=INPUT
//DDB DD DSN=MINE2,DISP=SHR
//DDC DD DSN=MINE3,DISP=SHR
// PEND
//STEP1 EXEC TPROC
//INPUT DD DSN=MYDSN1,DISP=SHR
// DD DSN=MYDSN4,DISP=SHR
//S2.INPUT DD DSN=MINE1,DISP=SHR
// DD DSN=MINE4,DISP=SHR
In this example, the result of the DDNAME forward reference INPUT
is:
- In step S1, DD1 resolves to data set MYDSN1 and data set MYDSN4 is concatenated to data set MYDSN3.
- In step S2, DDA resolves to data set MINE1 and data set MINE4 is concatenated to data set MINE3.