Referback in JCL

A backward reference is a reference to an earlier statement in the job or in a cataloged or in-stream procedure called by a job step. This is a way to reduce or simplify the coding in JCL. The information that is referred back should be in the same JOB.

In a DD statement, we can referback DCB, VOL, DSN

Syntax:


    Parameter=*.StepName.DDname
    PGM=*.LKED.SYSLMOD
    DSN=*.StepName.DDName

If the DD name points to a DD statement in the same job step, you can omit the stepname.

The following statements cannot be referenced:

  • DD * statement in DCB, DSNAME, or VOLUME parameter
  • DD DATA statement in DCB, DSNAME, or VOLUME parameter
  • DD DUMMY statement in VOLUME or UNIT parameter. The referring DD statement acquires a dummy status.
  • DD DYNAM statement
  • DD statement containing FREE=CLOSE in VOLUME or UNIT parameters
  • Nested procedure statements
  • Sysout DD statement
  • DD statement that is the target of a DDNAME= reference.
  • A DD statement containing a PATH parameter

Example of DD statement referback

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

Example of STEP statement referback

//JOB2    JOB   ...
//STEP1   EXEC  ...
//DDA     DD    DSNAME=PGPUB.FILE
             .
             .
//STEP2   EXEC  ...
//DDB     DD    DSNAME=*.STEP1.DDA

Example JCL referback to catalogued procedure.

//PS1     EXEC  ...
             .
             .
//PSTEP1  EXEC  ...
//DS1     DD    DSNAME=DATA1
//PSTEP2  EXEC  ...
//DS2     DD    DSNAME=DATA2
             .

The job referback to PROC DS1 and DS2 dataset

//JOB5    JOB   ...
//CALLER  EXEC  PROC=PROC1
             .
//REF1    DD    DSNAME=*.CALLER.PSTEP2.DS2
//NEXT    EXEC  ...
//REF2    DD    DSNAME=*.CALLER.PSTEP1.DS1


   File  Edit  Edit_Settings  Menu  Utilities  Compilers  Test  Help            
 -------------------------------------------------------------------------------
 EDIT       PROGPUB.AA.SOURCE(REFJCL) - 01.14              Columns 00001 00072 
 ****** ***************************** Top of Data ******************************
 ==MSG> -Warning- The UNDO command is not available until you change            
 ==MSG>           your edit profile using the command RECOVERY ON.              
 000001 //PROGPUBA JOB NOTIFY=PROGPUB                                           
 000002 //S1 EXEC PGM=PROG1                                                      
 000003 //STEPLIB DD DSN=PROGPUB.AA.LOAD,DISP=SHR                              
 000004 //SYSOUT DD SYSOUT=*                                                    
 000005 //SYSIN DD *                                                            
 000006 TEST RUN                                                                   
 000007 /*                                                                      
 000008 //S2 EXEC PGM=PROG2                                                     
 000009 //STEPLIB DD DSN=*.S1.STEPLIB,DISP=SHR                                  
 000010 //SYSIN DD DUMMY                                                        
 000011 //                                                                      
 ****** **************************** Bottom of Data ****************************