pTAL Conversion Guide

Statements
pTAL Conversion Guide527302-002
15-14
Branching From a Subprocedure to Its Containing
Procedure
Branching From a Subprocedure to Its Containing Procedure
A GOTO statement can branch from a subprocedure to a label in the containing
procedure.
TAL
You do not have to declare the label explicitly.
pTAL
You must declare the target label in a LABEL declaration in the containing procedure.
Example 15-19 on page 15-14 is the pTAL equivalent of Example 15-18 on
page 15-14.
Example 15-18. Branching From Subprocedure to Its Containing Procedure
(TAL)
PROC p1; ! Containing procedure p1
BEGIN
...
SUBPROC p2; ! Subprocedure p2 within p1
BEGIN
GOTO label_a; ! Branch to undeclared label_a in p1
END;
...
label_a: ! Establish location of label_a
...
END;
Example 15-19. Branching From a Subprocedure to Its Containing Procedure
(pTAL)
PROC p1;
BEGIN
LABEL label_a; ! Declare label_a explicitly
...
SUBPROC p2;
BEGIN
GOTO label_a;
END;
...
label_a:
...
END;