Examples of backward references

Example 1:
//JOB1    JOB   ...
//STEPA   EXEC  ...
//DD1     DD    DSNAME=REPORT
             .
             .
//DD4     DD    DSNAME=*.DD1

The referring and referenced DD statements are in the same step.

Example 2:
//JOB2    JOB   ...
//STEP1   EXEC  ...
//DDA     DD    DSNAME=D58.POK.PUBS01
             .
             .
//STEP2   EXEC  ...
//DDB     DD    DSNAME=*.STEP1.DDA

The referring and referenced DD statements are in different steps in the same job.

Example 3: Cataloged procedure PROC1 contains:
//PS1     EXEC  ...
             .
             .
//PSTEP1  EXEC  ...
//DS1     DD    DSNAME=DATA1
//PSTEP2  EXEC  ...
//DS2     DD    DSNAME=DATA2
             .
The job contains:
//JOB5    JOB   ...
//CALLER  EXEC  PROC=PROC1
             .
//REF1    DD    DSNAME=*.CALLER.PSTEP2.DS2
//NEXT    EXEC  ...
//REF2    DD    DSNAME=*.CALLER.PSTEP1.DS1
             .

DD statement REF1 in the calling step refers to DD statement DS2 in procedure step PSTEP2. DD statement REF2 in a step after the calling step refers to DD statement DS1 in procedure step PSTEP1. Note that the entire procedure is processed when the calling EXEC statement is processed; therefore, all DD statements in the procedure are earlier than all DD statements in the calling step.