Saturday, 10 August 2013

JCL Backward References | JCL Backward References Example

Backward References.
JCL Backward References.


In today's tutorial. I'll discuss backward reference parameters. Many parameters in job control statements can use a backward reference to fill in the information. 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. A backward reference is in the form:
  • *.name or *.ddname where name or ddname is the name field of the referenced statement.
  • *.stepname.name or *.stepname.ddname where the referenced statement, name or ddname, is in an earlier step, step-name, in the same job.
  • *.stepname.procstepname.name or *.stepname.procstepname.ddname where this job step or an earlier job step, step-name, calls a procedure; the procedure contains procedure step, proc step-name, which contains the referenced statement, name or ddname.
If step-name is specified without a proc step-name, it identifies an EXEC statement that contains a PGM parameter, not one that invokes a procedure. Similarly, if step-name.procstepname is coded, proc step-name identifies an EXEC statement containing the PGM parameter in the procedure invoked by step-name.

The backward reference lets you copy previously coded information or refer to an earlier statement. The following parameters can make backward references:
  • DD CNTL refers to earlier CNTL statement
  • DD DCB refers to earlier DD statement to copy its DCB parameter
  • DD DSNAME refers to earlier DD statement to copy its DSNAME parameter, whether or not the data set is a partitioned data set, and whether or not the data set is a temporary data set
  • DD OUTPUT refers to earlier OUTPUT JCL statement
  • DD REFDD refers to earlier DD statement to copy its data set attributes
  • DD VOLUME=REF refers to earlier DD statement to use the same volume(s). The LABEL label type subparameter is also copied from the referenced DD statement.
  • EXEC PGM refers to an earlier DD statement that defines the program to be executed as a member of a partitioned data set
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 1 : JCL Backward References Example

     //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 : JCL Backward References Example

 //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 : JCL Backward References Example

Cataloged procedure PROC1 contains:

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

The job contains:




Example 4 : JCL Backward References Example

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

Created with Artisteer

No comments:

Post a comment