Saturday 10 August 2013

JCL Tutorial: JCL Backward References | REFERBACK in JCL | [z/OS JCL Referback].

Backward References.

JCL Backward References.

JCL REFERBACK statement or Backwards Reference in JCL is a technique to copy attributes from previous DD statements. You're not required to code these parameters again and again. Instead, all required parameters on the first step and clone attributed in next steps via JCL REFER BACK statements.

Welcome to today's tutorial on "JCL Backwards Reference". In this session, you'll the basics of backward reference in JCL and how you can use JCL refer back statement in jobs. Let's get started with today's agenda. 

Agenda.
  • Introduction to Backwards Reference. 
  • JCL Backward Reference Advantage. 
  • JCL Backward Reference Syntax.
  • JCL Backward References Examples. 


Backward Reference Introduction.

A mainframe JCL is a combination of three different job control statements. These job control statements are JOB, DD, and EXEC statements. For each statement, you need to specify many different parameters. 

Being a program it is always tough to remember all these parameters. JCL has a facility called "JCL REFERBACK" to clone parameter information from the previous step.
In laymen's terms, JCL REFER BACK is a reference to a previous statement parameter. Backward reference in the JCL can be used in the job or in-stream procedure, or in a cataloged.  
JCL Refer back statements are best suited in situations, where you have tons of datasets in a JCL. Now, let's look at the advantage of JCL refer back. 

Backward Reference Advantage.

  • JCL REFER BACK statement saves time and reduces the possibility of typo error.
  • JCL REFER BACK statement is used to clone parameters value from previous steps. It also reduces code change efforts because you need to change the value of the parameter in the first step instead of all steps. 


JCL Backward Reference Syntax.

   parameter=*.[stepname.]ddname     

You can use refer back statements on the following job control statements. 
  • *.name or *.ddname: It is the referenced statement.
  • *.stepname.name or *.stepname.ddname: It is the referenced statement in the jcl.
  • *.stepname.procstepname.ddname: It is the proc step name or DDname etc with in the cataloged procedure or instream procedure. 


JCL Backword Reference Rules. 

You can use JCL backward reference statement to copy previously coded parameters. But, JCL refers back is not applicable for all job control statements. Following are the examples.
  • DD DUMMY Statement. 
  • SYSOUT DD Statement.
  • DD * statements in DSN-NAME etc. 


Backward References Examples.

Example 1: In the below example, both refer and referenced steps are in the same step. 

//TPXPTX01 JOB ..... (JOB CARD Parameters) 
//CALTAX01 EXEC PGM=TXTP01 
//EMPTX    DD  DSNAME=TP.EMP.INP.FILE . . 
//EMPOT    DD  DSNAME=*.EMPTAX

Example 2: In the below example, both refer and referenced steps are in different steps. 

//TPXPTX01 JOB ..... (JOB CARD Parameters) 
//CALTAX01 EXEC PGM=TXTP01 
//EMPTX    DD  DSNAME=TP.EMP.INP.FILE . . 
//EMPOT    DD  DSNAME=*.EMPTAX
//*
//CALTAX02 EXEC PGM=TXTP02 
//EMPTT    DD  DSNAME=*.CALTAX01.EMPTAX


Example 3: In the below example, both refer and referenced steps are in cataloged procedures. 

Cataloged procedure:
//EMPSAL  EXEC  ...
//EMPFL   DD DSNNAME=TP.PP.SAL.....
//        . 

JCL:
//TPXPTX01 JOB ..... (JOB CARD Parameters) 
//CALTAX01 EXEC PROC=EMPTAX01 
//EMPTXX   DD   DSNAME=*.CALTAX01.EMPSAL.EMPFL

JCL Backword Reference Rules. 


This session is associated with "JCL Tutorial - Backward Reference in JCL". Please do watch this video for a better understanding and consider subscribing to our channel.


Conclusion. 


Finally, JCL Refer back statement is very important from the programmer's perspective. It not only helps in saving time but also reduces typo mistakes. You can include all relevant parameters in the first step and then used the backward reference technique to copy the same information for all relevant next DD statements in JCL.    

►Subscribe to Topictrick & Don't forget to press THE BELL ICON to never miss any updates. Also, Please visit mention the link below to stay connected with Topictrick and the Mainframe forum on - 

► Youtube
► Facebook 
► Reddit

Thank you for your support. 
Mainframe Forum™
Created with Artisteer

No comments:

Post a Comment

New In-feed ads