Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

GetObjectArrayElement returns NULL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Java & MQSeries
View previous topic :: :: View next topic  
Author Message
Majid Hussain

New User


Joined: 18 Aug 2007
Posts: 20
Location: Bangalore

PostPosted: Wed Mar 30, 2016 2:59 am    Post subject: GetObjectArrayElement returns NULL
Reply with quote

Hi all

I am calling a Java program from a COBOL program. In an attempt to return multiple strings, I am returning an Array of Objects to the calling method.

Code:
public class TestClass {

       public static void main(String[] args)
       {
            .
       }

       public TestClass1[] execMethod(byte[] inString) {
            .
            .
            TestClass1[] test = new TestClass1[];
            .
            .
            return TestClass1
       }
}


When called from the Cobol program, I am getting no exceptions and also seems to get the length of the array correctly.

Code:
 
INVOKE Test-Class-obj  'execMethod'                     
USING BY VALUE ws-jbyteArray-obj                   
RETURNING test-class1-obj-array


Call GetArrayLength
   using by value JNIEnvPtr
   test-class1-obj-array   
returning test-class1-len



But when I try to get any element from the Array, it returns NULLs. Could someone please let me know if they have come any such error?

Code:

    Perform varying I from 0 by 1 until I = test-class1-len   
                     
       Call GetObjectArrayElement                 
       using by value JNIEnvPtr test-class1-obj-array I           
       returning test-class1-array-element                       
                                               
       Perform JavaExceptionCheck   

       if test-class1-array-element = null
       then
          display "Null object returned"
       end-if
    End-Perform


test-class1-array-element is always NULL. No matter what reference I use in working-storage section.
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7913
Location: Bellevue, IA

PostPosted: Wed Mar 30, 2016 7:30 am    Post subject: Reply to: GetObjectArrayElement returns NULL
Reply with quote

Inter-language issues are usually difficult to figure out. Have you successfully gotten a single variable to transfer between Java and COBOL? If not, why not start with that and get the interface working there before complicating the interface with arrays? If you have, what is different between the single variable and the array code?
Back to top
View user's profile Send private message
Majid Hussain

New User


Joined: 18 Aug 2007
Posts: 20
Location: Bangalore

PostPosted: Wed Mar 30, 2016 10:24 pm    Post subject: Reply to: GetObjectArrayElement returns NULL
Reply with quote

Yes. I have already got a String or ByteArray back from java program.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Java & MQSeries All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts DFHRESPONSE returns issue divated CICS 3 Wed Nov 02, 2016 6:32 pm
No new posts Syncsort - NULL in Integer field chec... nartcr SYNCSORT 4 Thu Oct 06, 2016 6:47 am
No new posts Converting NULL column into NOT NULL ... Raghu navaikulam DB2 5 Sat Aug 06, 2016 3:45 pm
No new posts Query to select Null row on priority RahulG31 DB2 24 Thu Jan 21, 2016 5:45 pm
No new posts Null Indicator value -2 means in Embe... deepak_shrivastava DB2 2 Wed Jan 06, 2016 10:27 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us