Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

JCI_CallStaticMethod

This function calls a static method.
It is equivalent to the JNI functions CallStatic<type>Method. However, it also offers the option of transferring or receiving strings directly.


Call

CALL 'JCI_CallStaticMethod' USING cObj mID arg res

cObj

Class object

mID

Method ID

arg

Method arguments

res

Method result


Arguments

cObj

Data field of the type JCI-object
Class object whose method is to be called.

mID

Data field of the type JCI-handle
ID of the method which is to be called. The method ID must be obtained by calling the function JCI_GetStaticMethodID for the cObj class.

arg

A structure of the form MethodArg
Description of the arguments for the method call (see section "Arguments and event values of Java methods").

res

A structure of the form MethodRes
Description of the return value for the method call and error information (see section "Arguments and event values of Java methods"). If the return value of the method is a NULL object, the length field of the target structure is set to 0 for the types RES-ANUM-STRING and RES-NAT-STRING, and the text area remains unchanged.


Return value (RETURN-CODE)

JCI-RET-OK

The call was successful.

JCI-RET-ENOVM

No Java VM has been started.

JCI-RET-ENULLOBJ

cObj is JCI-NULL.

JCI-RET-ENULLID

mId is JCI-NULL.

JCI-RET-EARGUMENT

cObj is not a class object.

JCI-RET-EARGVERS

The statically generated version number in arg is invalid (possibly overwritten).

JCI-RET-ERESVERS

The statically generated version number in res is invalid (possibly overwritten).

JCI-RET-EARGNUM

The number of arguments transferred (CallArgNum) is less than 0 or greater than the value used for <max-arguments> (see section "JCI-METHODARGS - Function arguments").

JCI-RET-EARGTYPE

The value of the ArgType field is invalid. The ResErrIndex field contains the number of the faulty argument.

JCI-RET-ERESTYPE

The value of the ResType field is invalid.

JCI-RET-EARGCONV

An error occurred while an argument was being converted.
The ResErrIndex field contains the number of the argument, the ResErrCode field a more precise error code.

JCI-RET-ERESCONV

An error occurred while the result was being converted.
The ResErrCode field contains a more precise error code.

JCI-RET-EEXCEPT

An exception exists after the method was called. No distinction is made between whether the exception was generated by this or an earlier function call.
The field corresponding to the method result in the res structure is unchanged.


Exceptions

All exceptions which were generated by the called method.


Example

DATA DIVISION.
WORKING-STORAGE SECTION.
...
01 MethodArgs.
COPY JCI-METHODARGS REPLACING ==<max-arguments>== BY 2.
01 MethodRes.
COPY JCI-METHODRES.
...
01 myName.
05 len PIC S9(9) COMP-5 VALUE 30.
05 txt PIC X(30).
01 classObj  TYPE JCI-object.
01 methodID  TYPE JCI-handle.
PROCEDURE DIVISION.
...
MOVE 1 TO CallArgNum
SET RES-VOID TO TRUE
SET ARG-ANUM-STRING(1) IGNORE-TRAILING-SPACES(1) TO TRUE
SET ArgValAddr(1) TO ADDRESS OF myName
CALL 'JCI_CallStaticMethod' USING classObj methodId
MethodArgs MethodRes
IF RETURN-CODE NOT = JCI-RET-OK
...