6 Subprograms and Program Section Repeats
4
6.4 Nesting
Repeating subprograms
Program layout
0 BEGIN PGM 3600612 MM
1
1
e.g. 10
LEL f
::
CALL l&L 2 . ..I.... << . . . . . .
2Xe3
4
..ltlhII-l . . . . - . . . . . Subprogram call
CALL
LBL 1 REP 2f2
. . . . . Program section repeat
0
4
+
e.g. 19
L Z+lOO RO FMAX M2 . ..__.__.___.._._._._____..... Last program block of main program with M2
20 LBL 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Beginning of subprogram
4
2
e.g. 28 LBL 0 ..___.._._.._._.__._.___.__.______,____.................. End of subprogram
29 END PGM 3600612 MM End of main program
Sequence of program execution
Step 1:
Step 2:
Step 3:
Step 4:
Main program 3600612 is executed to block 11.
Subprogram 2 is called and executed.
Program section between block 12 and block 10 is repeated
twice: subprogram 2 is repeated twice.
Main program 3600612 is executed from block 13 to block
19. End of program.
d
-,
d
-
4
6-12
TNC 370
4