The CALL statement transfers program execution to an external subroutine.
Command Syntax
CALL {@}subroutine.name {(argument {, argument ... })}
Syntax Elements
The CALL statement transfers program execution to the subroutine called subroutine.name, which can be any valid string either quoted or unquoted. The CALL @ variant of this statement assumes that subroutine.name is a variable that contains the name of the subroutine to call. The CALL statement may optionally pass a number of parameters to the target subroutine. These parameters can consist of any valid expression or variable name. If a variable name is used then the called program may return a value to the variable by changing the value of the equivalent variable in its own parameter list.
Notes
When using an expression to pass a parameter to the subroutine, you cannot use the built-in functions of jBASE BASIC (such as COUNT), within the expression. An unlimited number of parameters can be passed to an external subroutine. The number of parameters in the CALL statement must match exactly the number expected in the SUBROUTINE statement declaring the external subroutine. It is not required that the calling program and the external subroutine be compiled with the same PRECISION. However, any changes to precision in a subroutine will not persist when control returns to the calling program. Variables passed, as parameters to the subroutine may not reside in any COMMON areas declared in the program.
Example
CALL MySub
SUBROUTINEMySub
CALL Hello("World")
SUBROUTINE Hello (Message)
CALL Complex(i, j, k)
SUBROUTINE Complex(ComplexA, ComplexB, ComplexC)
0 comments:
Post a Comment