Summary -

In this topic, we described about the REFERBACK with detailed example.

The backward reference or refer back is used to get the information from the previous step to the current step to reduce the redundant coding. STAR (*) is used as refer back operator.

Syntax -

*.DDNAME Referring the DDNAME from previous step.
*.STEPNAME.DDNAME Referring the particular step’s DDNAME from previous steps.
*.PROC-NAME.DDNAME Referring the DDNAME from PROC which has only one step.
*.PROC-NAME.STEPNAME.DDNAME Referring the particular step’s DDNAME from the PROC.

Example 1:

//STEP01   EXEC PGM=PROG                                  
//INPUT    DD DSN=MTH.INPUT.FILE,DISP=SHR     
//OUTPUT   DD DSN=MTH.OUTPUT.FILE,            
//            DISP=(NEW,CATLG,DELETE),                    
//            SPACE=(CYL,(10,10),RLSE),                   
//            DCB=*.INPUT

In the above example, the DCB information is copied from input file MTH.INPUT.FILE.

Example 2:

//STEP01   EXEC PGM=PROG1                                  
//INPUT    DD DSN=MTH.INPUT.FILE,DISP=SHR
//OUTPUT   DD DSN=...... 
//STEP02   EXEC PGM=PROG2
//INPUT    DD DSN=......     
//OUTPUT   DD DSN=MTH.OUTPUT.FILE,            
//         DISP=(NEW,CATLG,DELETE),                    
//         SPACE=(CYL,(10,10),RLSE),                   
//         DCB=*.STEP01.INPUT

In the above example, the DCB information is copied from input file MTH.INPUT.FILE which is specified in STEP01.

Example 3:

//STEP01   EXEC PROC=MTHPROC                                  
//STEP03   EXEC PGM=PROG3
//STEP04   EXEC PGM=PROG4
//INPUT    DD DSN=......     
//OUTPUT   DD DSN=MTH.OUTPUT.FILE,            
//            DISP=(NEW,CATLG,DELETE),                    
//            SPACE=(CYL,(10,10),RLSE),                   
//            DCB=*.MTHPROC.INPUT

MTHPROC:

//MTHPROC
//STEP02   EXEC PGM=PROG2
//INPUT    DD DSN=MTH.INPUT.FILE,DISP=SHR

In the above example, the DCB information is copied from input file MTH.INPUT.FILE which is specified in MTHPROC.

Example 4:

//STEP01   EXEC PROC=MTHPROC                                  
//STEP03   EXEC PGM=PROG3
//STEP04   EXEC PGM=PROG4
//INPUT    DD DSN=......     
//OUTPUT   DD DSN=MTH.OUTPUT.FILE,            
//            DISP=(NEW,CATLG,DELETE),                    
//            SPACE=(CYL,(10,10),RLSE),                   
//            DCB=*.MTHPROC.STEP03.INPUT 

MTHPROC:

//MTHPROC
//STEP02   EXEC PGM=PROG2
//INPUT    DD DSN=......
//OUTPUT   DD DSN=......     
//STEP03   EXEC PGM=PROG3
//INPUT    DD DSN= MTH.INPUT.FILE,DISP=SHR 
//OUTPUT   DD DSN=......  

In the above example, the DCB information is copied from input file MTH.INPUT.FILE which is specified in STEP03 of MTHPROC.