CALL


CALL procedure_name

Where

procedure_name is the name of an STL procedure.

Function

The CALL statement passes control to the named STL procedure. All currently active ONIN, ONOUT, and ON SIGNALED conditions in the calling procedure remain active. When control returns from the called procedure (as a result of a RETURN or ENDTXT statement), execution of the calling procedure continues with the statement following the CALL.

Note: If this is coded as an asynchronous subset statement, the CALL will reset the WAIT condition of your simulated terminal, causing any outstanding WAIT conditions to be satisfied.

Examples

call editproc  /* Call the procedure that edits a file. */

Notes

  • All STL variables are global in scope; therefore, their values are available to all procedures in a program. Thus, a variable's value may not be the same after the return from a called procedure because the called procedure may have modified the variable. For instance, in the example below, the SAY statement in "proc1" writes a "2" to the operator since "proc2" has modified the value of “a”.
    proc1: msgtxt
    a = 1
    call proc2
    say char(a)
    endtxt
    
    proc2: msgtxt
    a = 2
    endtxt
  • You can make recursive calls (calls to the currently active STL procedure).
  • WSim limits the number of outstanding CALLs permitted for a terminal. The MAXCALL operand on the DEV, TP, or LU statements specifies this limit. If you do not code MAXCALL, WSim uses the default limit of five. See WSim language statements for more information about the MAXCALL operand.
  • When coded as an asynchronous subset statement, this statement must be coded directly following the THEN keyword on the ONIN, ONOUT, or ON SIGNALED statement.