I spent some time researching JNI from the previous responses and realized
that there was lot more functionality than I was aware of. I took Barbara's
advice and coded the following after looking into the QSYSIN/QRPGLESRC(JNI) source file and javadoc:

0084.00 d jnames

0085.00 d int1

0086.00 d jsize1

some code

0137.00 jnames= split(csvstr
: delimiter);

0138.00 jsize1= GetArrayLength(
JNIENV_P : jnames);

The two parameters (csvstr : delimiter)
are both String objects.

When I compile the program I get:

*RNF5343 30 3738 013700 Array
has too many omitted indexes; specification is

I took a guess and assigned a dim(50)
to the declaration of jnames and this time the program failed to compile,
but on the next line:

*RNF5343 30 3739 013800 Array
has too many omitted indexes; specification is


Am I on the right path? How should I be declaring jnames?

The JNI specification seems to have
definitions for all sorts of array types except for String arrays. jarray
seemed to be the closest thing to a String array as it resolves to an object type. Have I used the correct

The split method creates an array as
big as required and in Java simply returns a reference to the array object.

In my original Java code that worked:

String[] names;

String str1= "Mike,Elizabeth,John,Zoe,Katrina";

String delimiter= ",";

names= str1.split(delimiter);

I was then able to reference the
'names' as an array object.

How should I declare the RPG variable
jnames to get the dynamic allocation of elements from the String.split
Or doesn't it matter because jnames
is an object of type array?

Thanks again.......

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