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_NewObjectArray

This function generates an array object for object elements.
It is equivalent to the JNI function NewObjectArray.


Call

CALL 'JCI_NewObjectArray' USING num cObj eObj res

num

Number of elements

cObj

Element class

eObj

Element initil value

res

Result description


Arguments

num

Data field of the type JCI-size
Number of elements in the array.

cObj

Data field of the type JCI-object
Class object for the class of the array elements.

eObj

Data field of the type JCI-object
Initial value for the array elements (may also be JCI-NULL).

res

A structure of the form MethodRes
Return value (new object reference) in ResValObject. In the event of an error, the value JCI-NULL is returned.


Return value (RETURN-CODE)

JCI-RET-OK

The call was successful.

JCI-RET-ENULLOBJ

cObj is JCI-NULL.

JCI-RET-EARGUMENT

cObj is not a class object.

JCI-RET-EINDAOB

num is less than 0.

JCI-RET-ENOVM

No Java VM has been started.

JCI-RET-ERESVERS

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

JCI-RET-ERR

The array object could not be generated.


Exceptions

The exceptions generated by the function correspond to those of the JNI function NewObjectArray.


Example

DATA DIVISION.
WORKING-STORAGE SECTION.
COPY JCI-TYPEDEFS.
01 JCIConstants.
COPY JCI-CONST.
...
01 className.
05 len PIC S9(9) COMP-5 VALUE 40.
05 txt PIC X(40) VALUE SPACE.
01 classObj TYPE JCI-object.
01 initObj  TYPE JCI-object.
01 arrayObj TYPE JCI-object.
01 numElements PIC S9(9) COMP-5.
...
...
01 MethodRes.
COPY JCI-METHODRES.
...
PROCEDURE DIVISION.
*>
*> Create array of 10 String-elements
*>
MOVE 'java/lang/String' TO txt IN className
CALL 'JCI_FindClass' USING className classId
IF RETURN-CODE NOT = JCI-RET-OK
...
END-IF.
MOVE 10 TO numElements
MOVE JCI-NULL TO initObj
CALL 'JCI_NewObjectArray' USING numElements classId
initObj MethodRes
IF RETURN-CODE NOT = JCI-RET-OK
...
END-IF.
MOVE ResValObject TO arrayObj
...