────CALL───┬───name────┬──────────────────────────┬─────;─ │ │ ┌──────,───────┐ │ │ │ │ │ │ └───┴──expression──┴───────┤ │ │ ├───OFF─────┬──ERROR──────┬────────────┤ │ ├──FAILURE────┤ │ │ ├──HALT───────┤ │ │ └──NOTREADY───┘ │ │ │ └──ON──┬─ERROR────┬─┬───────────────┬──┘ ├─FAILURE──┤ └─NAME─trapname─┘ ├─HALT─────┤ └─NOTREADY─┘
CALL is used to invoke a routine (if you specify name) or to control the trapping of certain conditions (if ON or OFF is specified)
To control trapping, specify OFF or ON and the condition you want to trap. OFF turns off the specified condition trap. ON turns on the specified condition trap.
To invoke a routine, specify name, which is a symbol or literal string that is taken as a constant. The name must be a valid symbol. The routine invoked can be any of the following:
o
If a string is used for name (that is, name is specified in quotation marks) the search for internal labels is bypassed, and only a built-in function or an external routine is invoked. Note that the names of built-in functions (and generally the names of external routines too) are in uppercase; therefore, the name in the literal string should be in uppercase.
The routine can optionally return a result and is functionally identical to the clause:
─result=name(─┬────────────────────┬─)──;── │ ┌──────,────────┐ │ │ │ │ └─┴┬────────────┬─┴──┘ └─expression─┘
The exception is that the variable result becomes uninitialized if no result is returned by the routine invoked.
The name given in the CALL instruction must be a valid symbol.
The OS/2 interpreter supports the specification of up to 20 expressions, separated by commas. The expressions are evaluated in order from left to right, and form the argument strings during execution of the routine. Any ARG or PARSE ARG instructions or ARG built-in function in the called routine will access these strings rather than those previously active in the calling program. You can omit expressions, if appropriate, by including extra commas.
The CALL then causes a branch to the routine called name using the same mechanism as function calls. The order in which these are searched for is described in the section on functions. A brief summary follows:
Internal routines: