JCL Referback Example


Scenario1 - Using the DCB of INPUT ddname in the same step.

Code -

----+----1----+----2----+----3----+----4----+----5----+
//STEP02   EXEC PGM=PROG
//INPUT    DD DSN=MTH.INPUT.FILE2,DISP=SHR
//OUTPUT   DD DSN=MTH.OUTPUT.FILE,
//            DISP=(NEW,CATLG,DELETE),
//            SPACE=(CYL,(10,10),RLSE),
//            DCB=*.INPUT

Explaining Example -

In the above example, MTH.OUTPUT.FILE created with the same DCB as the MTH.INPUT.FILE2.

Scenario2 - Using the DCB of INPUT ddname of other step.

Code -

----+----1----+----2----+----3----+----4----+----5----+
//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

Explaining Example -

In the above example, MTH.OUTPUT.FILE created with the same DCB as the MTH.INPUT.FILE from STEP01.

Scenario3 - Using DCB of INPUT ddname from MTHPROC.

Code -

----+----1----+----2----+----3----+----4----+----5----+
//MTHPROC  PROC
//STEP02   EXEC PGM=PROG2
//INPUT    DD DSN=MTH.INPUT.FILE,DISP=SHR
//*
//STEP01   EXEC 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

Explaining Example -

In the above example, MTH.OUTPUT.FILE created with the same DCB as the MTH.INPUT.FILE from STEP02 of MTHPROC.

Scenario4 - Using DCB of INPUT ddname of STEP03 from MTHPROC.

Code -

----+----1----+----2----+----3----+----4----+----5----+
//MTHPROC  PROC
//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=......
//*
//STEP01   EXEC 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