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.

Errors in location of referenced DD statement: The system treats a DDNAME parameter as though it were a DUMMY parameter and issues a warning message in the following cases:
  • 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.
Location of DD statement requesting unit affinity: To use the same device, a DD statement can request unit affinity to an earlier DD statement by specifying UNIT=AFF=ddname. If a DD statement requests unit affinity to a DD statement containing a DDNAME parameter, the DD statement requesting unit affinity must be placed after the referenced DD statement. If the DD statement requesting unit affinity appears before, the system treats the DD statement requesting unit affinity as a DUMMY DD statement.
   //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.