Previous Topic Next topic Print topic


INVOKE Statement

Invokes a method.

invoke-statement

method-invocation-expression

Example

In the following example, the arguments a and b above are passed to the invoked method, and these correspond to the parameters x and y respectively, in the invoked method. The types of the parameters are specified in the AS phrase of the USING clause.

       01 a string.
       01 b binary-long.
       invoke type MyClass::MyMethod(a,b)
       ...

       method-id MyMethod.
       procedure division using x as string  
                                y as binary-long.
       ...
       end method.

See also the Core sample, which is available from Start > All Programs > Micro Focus Visual COBOL > Samples , under COBOL for JVM (Windows) or $COBDIR/demo (UNIX).

Previous Topic Next topic Print topic