TAL Reference Manual
Standard Functions
TAL Reference Manual—526371-001
14-33
Usage Considerations
string
is the identifier of a STRING array or simple pointer declared inside or outside
a structure.
length
is an INT expression that specifies the length, in bytes, of string.
Usage Considerations
A call to a VARIABLE or EXTENSIBLE procedure can omit some or all parameters.
$OPTIONAL lets your program pass a parameter (or parameter-pair) based on a
condition at execution time. $OPTIONAL is evaluated as follows each time the
encompassing CALL statement is executed:
•
If cond-expression is true, the parameter is passed; $PARAM, if present, is set to
true for the corresponding formal parameter.
•
If cond-expression is false, the parameter is not passed; $PARAM, if present, is set
to false for the corresponding formal parameter.
A called procedure cannot distinguish between a parameter that is passed
conditionally and one that is passed unconditionally. Passing parameters conditionally,
however, is slower than passing them unconditionally. In the first case, the
EXTENSIBLE mask is computed at execution time; in the second case, the mask is
computed at compilation time.
Examples of the $OPTIONAL Function
1. This example shows that a called procedure cannot distinguish between a
parameter that is passed conditionally and one that is passed unconditionally:
PROC p1 (i) EXTENSIBLE;
INT i;
BEGIN
!Lots of code
END;
PROC p2;
BEGIN
INT n := 1;
CALL p1 ($OPTIONAL (n > 0, n) ); !These two calls are
CALL p1 (n); ! indistinguishable.
END;
:
string length
VST1435.vsd