pTAL Conversion Guide

Statements
pTAL Conversion Guide527302-002
15-8
CASE Statement
pTAL
A procedure’s formal and actual parameters match if the data type of each formal
parameter and its corresponding actual parameter match exactly or match if the data
type of the actual parameter is converted according to the rules in Table 10-5 on
page 10-21 and Table 10-6 on page 10-22.
In Example 15-8 on page 15-8, TAL accepts all three parameters in the CALL
statement; pTAL reports syntax errors for all three parameters to the CALL statement:
CASE Statement
Topics:
CASE Statement Operation When No Alternatives Match the Index on page 15-8
Empty CASE Statements on page 15-10
INT(32) Expression in a CASE Statement Index or Selector on page 15-10
CASE Statement Operation When No Alternatives Match the
Index
A CASE index matches an alternative identified by the keyword OTHERWISE if and
only if the case index does not match any other alternative and OTHERWISE is an
alternative.
In Example 15-9 on page 15-9, the value of the case index, i, is peach. Because
peach is not an alternative, the CASE statement executes the code following the
OTHERWISE label.
Example 15-8. CALL Statement
PROC p (a, b, c);
INT(32) a;
REAL b;
REAL(64) c;
BEGIN
...
END;
PROC q;
BEGIN
CALL p(1.0E0, ! ERROR: Cannot pass REAL to INT(32) !
1D, ! ERROR: Cannot pass INT(32) to REAL !
1F); ! ERROR: Cannot pass FIXED to REAL(64) !
END;
Note. In pTAL, you cannot declare a STRING value parameter. See Section 16, Procedures,
Subprocedures, and Procedure Pointers, for more information.