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_CreateJavaVM

This function generates, i.e. loads and initializes, the Java VM.
It is equivalent to the JNI function JNI_CreateJavaVM.


Call

CALL 'JCI_CreateJavaVM' USING opt

opt

Options for the Java VM


Arguments

opt

A structure in the form OptArg with the following elements:

VMOptNum

The number of VM options; the value may not exceed the value specified for <max-options> (see section "JCI-VMOPT - Structure for transferring options" ).

VMOptFlag

Displays whether unknown options are to be ignored (condition name IGNORE-UNRECOGNIZED).

VMOptVstring

For each option, the address of a Cobvar structure.Trailing spaces at the end of the text are ignored

VMExtrainf

Depending on the option, the address of an external function.

All options can be specified which are also permissible in the JNI function JNI_CreateJavaVM.


Return value (RETURN-CODE)

JCI-RET-OK

The call was successful.

JCI-RET-EVERSION

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

JCI-RET-EOPTNUM

The number of options transferred (VMOptNum) is less than 0 or greater than the value specified for <max-options> (see section "JCI-VMOPT - Structure for transferring options").

JCI-RET-EEXIST

A Java VM has already been generated.

JCI-RET-ENOMEM

Not enough memory is available to generate the Java VM.

JCI-RET-ERR

An error which is not specified in more detail has occurred (e.g. invalid option and IGNORE-UNRECOGNIZED not set).


Notes

Only one JavaVM can be generated in a program run.

No new Java VM can be generated after terminating the VM with JCI_DestroyJavaVM, either.


Example

DATA DIVISION.
WORKING-STORAGE SECTION.
01 OptCP.
05 PIC S9(9) COMP-5 VALUE 30.
05 PIC X(30) VALUE '-Djava.class.path=.'.
01 OptEnc.
05 PIC S9(9) COMP-5 VALUE 40.
05 PIC X(40) VALUE '-Dfile.encoding=OSD_EBCDIC_DF04_15'.
01 JVMOptions.
COPY JCI-VMOPT REPLACING == <max-options> == BY 2.
...
PROCEDURE DIVISION.
*>
*> Prepare VM options
*>
MOVE 2 TO VMOptNum.
SET IGNORE-UNRECOGNIZED TO FALSE.
SET VMOptVstring(1) TO ADDRESS OF OptCP
SET VMOptVstring(2) TO ADDRESS OF OptEnc
*>
*> Create the Java VM
*>
CALL 'JCI_CreateJavaVM' USING JVMOptions
IF RETURN-CODE NOT = JCI-RET-OK
...