CALL


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 may not use any of the built-in functions of jBC (such as COUNT), within the expression.

There is no limit to the number of parameters that may 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 to 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.

 

EXAMPLES

CALL MySub

SUBROUTINEMySub

CALL Hello("World")

SUBROUTINE Hello (Message)

CALL Complex(i, j, k)

SUBROUTINE Complex(ComplexA, ComplexB, ComplexC)


jBC