pTAL Conversion Guide

Procedures, Subprocedures, and Procedure
Pointers
pTAL Conversion Guide527302-002
16-20
Using Formal STRING Value Parameters
pTAL
In pTAL, you can pass a procedure or procedure pointer that includes an
EXTENSIBLE, VARIABLE, or RETURNSCC attribute as a parameter to a procedure
whose formal parameter is a PROC, but you cannot reference the PROC formal
parameter identifier in a CALL statement. Instead, you must assign the address from
the formal parameter to a procedure pointer and then specify procedure pointer in a
CALL statement, as in Example 16-16 on page 16-20.
Using Formal STRING Value Parameters
TAL
In TAL, a one-byte actual parameter is passed to a formal STRING parameter as an
INT value with the one-byte value right-justified in the two-byte INT. A simple reference
to the byte from inside the called procedure does not find the byte because the byte is
in the right half of the word, whereas the reference inside of the procedure refers to the
byte in the left half of the word.
Your TAL program must compensate for the location of the byte. You can use various
techniques, such as the one in Example 16-17 on page 16-21.
Example 16-16. VARIABLE, EXTENSIBLE, and RETURNSCC Procedures as
Actual Parameters (pTAL)
PROC p1 (i, j) EXTENSIBLE;
INT i, j;
EXTERNAL;
PROC p2( p );
PROC p;
BEGIN
PROCPTR pp(a, b) EXTENSIBLE;
INT a, b;
END PROCPTR;
INT i, j;
...
CALL pp(i, j);
END;
PROC p3;
BEGIN
CALL p2(p1);
END;