Nesting procedures
The following example shows how procedures can be nested:
Procedure C:
//C PROC
//CS1 EXEC PGM=GHI
.
// PEND
Procedure B:
//B PROC
//BS1 EXEC PROC=C
.
//BS2 EXEC PGM=DEF
.
// PEND
Procedure A:
//A PROC
//AS1 EXEC PROC=B
.
//AS2 EXEC PGM=ABC
.
// PEND
Job Stream:
//JOB1 JOB
//STEP1 EXEC PROC=A
.
//STEP2 EXEC PGM=JKL
.
.
The following statements are equivalent to the nested procedures
shown above and
show the levels of nesting (scoping) for the procedures.
//JOB1 JOB Level 0
//CS1 EXEC PGM=GHI Level 3
.
//BS2 EXEC PGM=DEF Level 2
.
//AS2 EXEC PGM=ABC Level 1
.
//STEP2 EXEC PGM=JKL Level 0
.
.