Page 1 of 1

Error invoking java method (array) IGZ0045S

PostPosted: Mon Nov 07, 2022 3:54 pm
by JgbCobol
Hello,

I am trying to execute a java method that receives an Integer array (I also tried with Byte array) and I get the following error:

IGZ0045S Unable to invoke method metodoIntA

In Cobol I have this coded:

01 DataIntArray  object reference jintArray.
     Call NewIntArray using
       by value JNIEnvPtr
       by value 5
       returning DataIntArray

     If DataIntArray not = null then
         Display "NewObjectArray returned OKKKKK"
     Else
         Display "NewObjectArray returned null!"
         Stop run
     End-if

     Invoke Hello "metodoIntA" using  by value DataIntArray

 


I have this in Java:

   public static void metodoIntA(Integer[] name)
    {
        System.out.println("---metodoIntA--");
        System.out.println("HELLO " + name);

    }



However, if I execute a method that receives a STRING or an Integer that is not an Array it works OK.

Cobol Code:

01 stringBuf      pic X(32000) usage display.
 01 jstring1       object reference JavaString.

      Call "NewStringPlatform"
        using by value JNIEnvPtr
                  address of stringBuf
                  address of jstring1
                  0
     Invoke Hello "metodoString" using by value jstring1


Java Code:

   public static void metodoString(String name)
    {
        System.out.println("---metodoString--");
        System.out.println("Hello" + name);

    }
 



How do I call a method that receives an array of objects or Integers?

My current cobol version is 4.2.

Thank you.

Re: Error invoking java method (array) IGZ0045S

PostPosted: Mon Nov 07, 2022 9:39 pm
by Robert Sample
What does your COBOL REPOSITORY look like?

Re: Error invoking java method (array) IGZ0045S

PostPosted: Tue Nov 08, 2022 12:32 pm
by JgbCobol
I think it is a problem of the cobol version. The 4.2 has Java support but less advanced in terms of data compatibility between Cobol-Java calls.

The solution that I have realized is perhaps more oriented to a higher Cobol version.

I will try to test with a higher 6.X version.