Manual

Introduction to Programming
Chapter 10
1
0
-
1
5
We use the term nesting to describe one program calling another. The
program called is a nested program. When a subprogram is called from the
main program it is on the first nesting level or nesting level 1. If that
subprogram in turn calls another subprogram, the called subprogram is in
nesting level 2. Subprograms can be nested up to a maximum of 4 levels.
Figure 10.3
Subprogram Nesting
Main
program
Sub-
program 1
Sub-
program 2
Sub-
program 3
Sub-
program 4
Level 1 Level 2 Level 3 Level 4
M02;p M99; M99; M99; M99;
M98P11111;
M98P22222;
M98P33333;
M98P44444;
0 00001; 0 11111; 0 22222; 0 33333; 0 44444;
Important: Calling a macro does not add to the nesting level of any active
subprograms. Up to 4 subprograms can still be nested, but the combined
total of nested macros and subprograms cannot exceed 8. See chapter 28
for information on macros.
10.3.3
Subprogram Nesting