pTAL Conversion Guide

Procedures, Subprocedures, and Procedure
Pointers
pTAL Conversion Guide527302-002
16-16
Using PROCs as Formal Parameters
After you have assigned a value to a PROCPTR variable—that is, when it points to a
procedure—you can call that procedure by using the PROCPTR name in a CALL
statement or, if the PROCPTR is typed, in an expression.
Using PROCs as Formal Parameters
TAL
In TAL, a formal parameter to a procedure can be a PROC.
In Example 16-12 on page 16-16, procedure c calls procedure b, c passes the name
of the procedure that b is to call, a.
In TAL, the actual parameter to procedure b can optionally be prefixed with an @
character. The behavior of your program in TAL is not affected by whether the @
character is present or not.
pTAL
In pTAL, the @ character is not allowed if the formal parameter is a procedure.
@a := @p;
@d := @s1[2].f;
@s1[3].f := @d;
CALL c(d);
Example 16-11. Using a PROCPTR Variable
CALL a(1, 2);
r := d(r);
IF (s1[i].f(r)) < 1.0E0 THEN ...
Example 16-12. Procedures as Formal Parameters (TAL)
PROC a; EXTERNAL;
PROC b(p); ! Parameter p is a procedure
PROC p;
EXTERNAL;
PROC c;
BEGIN
CALL b(a); ! OK
CALL b(@a); ! Invalid in pTAL
END;
Example 16-10. Assigning Values to PROCPTR Variables (page 2 of 2)