Error invoking java method (array) IGZ0045S



Support for Java SE, EE & ME, JVM, JNI, JDBC, EJB, JFC, JPDA, JAAS,JCE, JAXP, XML and Java API.

Error invoking java method (array) IGZ0045S

Postby JgbCobol » Mon Nov 07, 2022 3:54 pm

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.
JgbCobol
 
Posts: 2
Joined: Mon Nov 07, 2022 3:17 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Error invoking java method (array) IGZ0045S

Postby Robert Sample » Mon Nov 07, 2022 9:39 pm

What does your COBOL REPOSITORY look like?
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: Error invoking java method (array) IGZ0045S

Postby JgbCobol » Tue Nov 08, 2022 12:32 pm

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.
JgbCobol
 
Posts: 2
Joined: Mon Nov 07, 2022 3:17 pm
Has thanked: 0 time
Been thanked: 0 time


Return to Mainframe Java

 


  • Related topics
    Replies
    Views
    Last post