This function copies part of a Java string to a data area provided.
It is equivalent to the JNI function GetStringRegion
. However, it also offers the option of obtaining alphanumeric (EBCDIC) strings directly.
Call
CALL 'JCI_GetString' USING
sObj start res
sObj | String object |
start | Start position |
res | Result description |
Arguments
sObj | Data field of the type |
start | Data field of the type |
res | A structure of the form |
Return value (RETURN-CODE)
JCI-RET-OK
The call was successful.
JCI-RET-ENOVM
No Java VM has been started.
JCI-RET-ENULLOBJ
sObj is JCI-NULL
.
JCI-RET-EARGUMENT
sObj is not a string object.
JCI-RET-EINDAOB
start is less than 1 or greater than the number of characters in the Java string.
JCI-RET-ERESVERS
The statically generated version number in res is invalid (possibly overwritten).
JCI-RET-ERESTYPE
The value of the ResType
field is invalid.
JCI-RET-ERESCONV
An error occurred while the string was being converted.
The ResErrCode
field contains a more precise error code.
Notes
The maximum length of the transfer (length of Java string – start + 1) or of the value len equals that of the output structure.
Example
DATA DIVISION. WORKING-STORAGE SECTION. COPY JCI-TYPEDEFS. 01 JCIConstants. COPY JCI-CONST. ... 01 sObj TYPE JCI-object. 01 sPos PIC S9(9) COMP-5 VALUE 0. 01 sLen PIC S9(9) COMP-5 VALUE 0. 01 aText. 05 alen PIC S9(9) COMP-5 VALUE 80. 05 atxt PIC X(80) VALUE SPACE. ... 01 MethodRes. COPY JCI-METHODRES. ... PROCEDURE DIVISION. ... CALL 'JCI_GetStringLength' USING sObj sLen IF RETURN-CODE NOT = JCI-RET-OK ... END-IF. SET RES-ANUM-STRING TO TRUE SET ResValAddr TO ADDRESS OF aText MOVE LENGTH OF atxt TO alen *> loop to output the complete java-string PERFORM VARYING sPos FROM 1 BY alen UNTIL sPos > sLen CALL 'JCI_GetString' USING sobj sPos MethodRes IF RETURN-CODE NOT = JCI-RET-OK ... END-IF DISPLAY aTxt(1:aLen) UPON T END-PERFORM ...