pTAL Reference Manual (G06.24+, H06.09+, J06.03+)
For more information:
SourceTopic
Procedure Declarations (page 246)Procedure declarations
Subprocedure Declarations (page 257)Subprocedure declarations
Procedure Attributes (page 248)RETURNSCC procedure attribute
RETURN (page 223)RETURN statement
Returning the Value of $OVERFLOW or $CARRY to the Calling Procedure
A called procedure cannot return the value of $OVERFLOW or $CARRY to its caller. To achieve
this effect, set variables with the values of these indicators and return the variables’ values using
either parameters, global variables, or return values.
Example 199 Returning the Value of $OVERFLOW in a Reference Parameter
PROC p; ! Calling procedure
BEGIN
INT rtn_ovfl;
CALL q(rtn_ovfl); ! q returns rtn_ovfl
IF rtn_ovfl = 0 THEN ... ! Test value of rtn_ovfl
END;
PROC q(ovfl); ! Called procedure
INT .ovfl;
BEGIN
INT i := 32767;
i := i + 1;
IF $OVERFLOW THEN ! Test hardware indicator and
ovfl := 1 ! set ovfl
ELSE
ovfl := 0;
END; ! Return ovfl to caller
Using Hardware Indicators Across Procedures 245