Location in the JCL
Place a DD statement containing a DDNAME parameter in a job step or in a cataloged or in-stream procedure. The referenced DD statement must be later in the same job step, must be in the calling job step, or must be in a cataloged or in-stream procedure called by the job step.
Do not use the name of a DDNAME statement more than once within the same step.
Location of DD statements for concatenated data sets: To concatenate data sets to a data set defined with a DDNAME parameter, the unnamed DD statements must follow the DD statement that contains the DDNAME parameter, not the referenced DD statement that defines the data set.
- If the job step or called procedure does not contain the referenced DD statement.
- If the referenced DD statement appears earlier in the job step.
//STEP EXEC PGM=TKM
//DD1 DD DDNAME=DD4
//DD2 DD DSNAME=A,DISP=OLD
.
.
//DD4 DD DSNAME=B,DISP=OLD
//DD5 DD UNIT=AFF=DD1
DD1 postpones defining the data set until DD4. DD5 requests unit affinity to DD1. Because DD1 has been defined when DD5 is processed, the system assigns DD5 to the same device as DD1.
Instead of specifying UNIT=AFF=ddname, both DD statements can specify the same devices in their UNIT parameters or the same volume serials in their VOLUME parameters.