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

Add comment

This website uses cookies

We use cookies to improve user experience. By continuing to browse our website or by clicking accept, you agree to our use of cookies.

Read more about how we use cookies and how you can refuse them.

Subscribe for more goodness!

Do you like what I'm writing? Sign up to receive new content straight into your mailbox!