× 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.



Hello,

I have to agree that really the JNI solution "is not the easiest soluton" as
Michael stated in his prior mail. 

I am going to call a CallObjectMethodA JNI method and finding that the job
is much more complex than I anticipated before :-(.
Please can someone check my following lines to assure me that I am on the
right track? we have V5R2

My sequence of logical deductions (=>):
1.
JNI member contains the prototype for CallObjectMethodA JNI method:
D CallObjectMethodA...                                       
D                 PR                  LIKE(jobject)          
D                                     EXTPROC(*CWIDEN        
D                                     : JNINativeInterface.  
D                                       CallObjectMethodA_P) 
D env                                 LIKE(JNIEnv_P) VALUE   
D obj                                 LIKE(jobject) VALUE    
D methodID                            LIKE(jmethodID) VALUE  
D args                                LIKE(jvalue) DIM(1)    

=> I have to pass methodID of the java-array method.

2. I get methodID using another JNI method GetMethodID that is prototyped
like this:
D GetMethodID     PR                  LIKE(jmethodID)       
D                                     EXTPROC(*CWIDEN       
D                                     : JNINativeInterface. 
D                                       GetMethodID_P)      
D env                                 LIKE(JNIEnv_P) VALUE  
D clazz                               LIKE(jclass) VALUE    
D name                            *   OPTIONS(*STRING) VALUE
D sig                             *   OPTIONS(*STRING) VALUE

=> I have to pass also: 
jclass object,
name of java-array method,
signature of java-array method.
name & signature must be in UTF-8 according to GetMethodID spec at
http://java.sun.com/j2se/1.3/docs/guide/jni/spec/functions.doc.html#16660
=> I must know how to get a class object from a class.
=> I must know how to convert EBCDIC to UTF-8.

3. I get the class object using GetObjectClass JNI method.

4. I can convert RPG literals for java-array method name & signature using
ldap_xlate_local_to_utf8() API.
(I found an example from Scott Klement at iseriesnetwork RPG forum.)

Thanks for reading up to this point.

Otto Steffan


-----Original Message-----
From: Rooney, Michael P [mailto:michael.p.rooney@xxxxxxxxxxxxx]
Sent: Monday, April 12, 2004 4:37 PM
To: RPG programming on the AS400 / iSeries
Subject: RE: Java array in ILE RPG


Jon,

You haven't missed a thing.

As I stated in one of my previous posts, using the JNI via RPG
to process a Java Array Object involves more code than Barbara's
solution.

Clearly there are (always) serveral ways to accomplish an objective.
Thus, sometimes the more significant challenge for us technologists is
using the solution best suited for the problem at hand (verses the one
that stimulates the techie in each of us).

While I have contributed to this post, I can not definitively say
which of these options I would use as each of the 3 have merit. Without
hesitation, though, a JNI solution presents the most complexity.        It
may be "cool" but it is not the easiest soluton.

Regards,

Michael Rooney
Citigroup International

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.