× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Barbara,

As always, thanks for your invaluable feedback and comments.  As I did not 
study Otto's
code I was not assuming the Java Array Object was being passed between RPG and 
Java an
array.  I was simply addressing the question of how to retrieve the number of 
objects in
a Java Array Object within an RPG program.

Also, as you indicated, when using the compiler/runtime Java support RPG does 
not have
access to the actual number of elements in the java object array, however, the 
number of
elements should still be accessible using direct JNI calls.  This isn't exactly 
straight
forward as the program would need have to make multiple JNI calls, but it is 
possible (just
not easy).

Clearly your solution of checking for *NULL is straight forward and involves 
much less coding
than using JNI calls.

Sincerely,

Michael Rooney
Citigroup International


   

         




-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Barbara Morris
Sent: Thursday, April 01, 2004 3:47 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: Java array in ILE RPG


"Rooney, Michael P [CI]" wrote:
> 
> otto,
> 
> Have you tried the JNI function "GetArrayLength" to determine the number of 
> elements in the array?
> To retrieve elements from an Object array-type you would use the 
> "GetObjectArrayElement" JNI
> function.
> 

Michael, Otto is using the RPG support that wrappers the JNI.  The RPG
compiler/runtime handles calling GetObjectArrayElement and copying the
Java array into the RPG array, setting any unpassed elements to null. 
Since RPG doesn't have variable-dimension arrays, the RPG program can't
get at the actual number of elements in the Java array.  (Although it
_is_ possible for RPG programmers to do the JNI calls directly.)

_______________________________________________
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.