Highlighted
Absent Member.
Absent Member.
802 views

[archive] Acu 7.1.3 calling Java

[Migrated content. Thread originally posted on 09 January 2008]

We are experimenting with using Java as a bridge between Acu and other libraries that we are soon to be implementing. These are the problems I've encountered thus far when calling methods with an array as a paramater.


1. Converting integer table to a java array (code straight from the acu sample code):

CALL "C$JAVA" USING CJAVA-CONVERTTABLETOARRAY,   
INT-TABLE(1), 10, 1, ARRAY-HANDLE, GIVING STATUS-VAL.

Causes a memory access violation.

2. Passing through a table directly

01 INT-GROUP.
            03  INT-DATA occurs 10 times.
                05  INT-ELEMENT signed-int.
....
MOVE 91 TO INT-ELEMENT(1)
MOVE 92 TO INT-ELEMENT(2)
...
CALL "C$JAVA" USING CJAVA-CALLNONVIRTUAL, OBJECT-HANDLE,
               CLASS-NAME, METHOD-NAME, "([I)I",
               INT-GROUP, FIELD-INT-RET GIVING STATUS-VAL.

Works, but everything in the array is 0.

3. Calling a method that returns an array:

CALL "C$JAVA" USING CJAVA-CALLNONVIRTUAL, OBJECT-HANDLE,
               CLASS-NAME, METHOD-NAME, "([I)[I",
               INT-GROUP, INT-RET-GROUP GIVING STATUS-VAL.

After this call STATUS-VAL is zero, indicating it worked, but the logging within the method has not been executed, i.e. the method does NOT get called.

4. Calling a method with a multidimensional array as a paramater:
   
CALL "C$JAVA" USING CJAVA-CALLNONVIRTUAL, OBJECT-HANDLE,
               CLASS-NAME, METHOD-NAME, "([[I)I",
               INT-MULTI-GROUP, FIELD-INT-RET GIVING STATUS-VAL. 


Gives a -4 error, method not found.


Incidently, using this:

CALL "C$JAVA" USING CJAVA-CREATEARRAY, CJAVA-INTARRAY,
                ARRAY-SIZE GIVING ARRAY-HANDLE.
MOVE 1 to FIELD-INT.
CALL "C$JAVA" USING CJAVA-SETARRAYELEMENT, ARRAY-HANDLE, 1,
                FIELD-INT, GIVING STATUS-VAL.
....
CALL "C$JAVA" USING CJAVA-CALLNONVIRTUAL, OBJECT-HANDLE,
               CLASS-NAME, METHOD-NAME, "([I)I",
               ARRAY-HANDLE, FIELD-INT-RET GIVING STATUS-VAL.


does work.



Does anyone know if these issues are fixed in a later version of Acu? Has anyone had any luck passing arrays to java methods?

Cheers,

Andy.
0 Likes
2 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Acu 7.1.3 calling Java

ecn3414 in version 8.0 corrected some problems when dealing with Java Arrays

For a mav it would be best to known what operating system you're working on.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Acu 7.1.3 calling Java

I was doing all testing on Windows XP, but we also need to use Solaris (haven't gotten around to trying that out yet).
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.