|
Bill Fly wrote:
I suggest you use a byte array in Java. It works a lot better than a String.
Very true, if you mean for the purposes of returning a value to RPG.
Within Java itself, a String is usually "better".
The same is true for parameters to methods; it's easier in RPG if the
Java method expects byte array parameters.
Mike, if you call a particular Java method with String return value or
parms frequently from RPG, and also from Java, you could consider having
a Java wrapper for the method that would use byte arrays. With byte
arrays, you can code the RPG prototype to use a character type, say
65535A VARYING.
Say you have this Java method:
String mymethod (int parm1, String parm2)
{
...
return someString;
}
RPG call:
stringparm = newString('abcde');
s = mymethod (5, stringparm);
svalue = getBytes (s);
or
svalue = getBytes (mymethod (5, newString('abcde')));
Then you could add this method for RPG programs to call.
byte[] mymethodB (int parm1, byte[] parm2)
{
return mymethodB(parm1, new String(parm2)).getBytes();
}
RPG call:
svalue = mymethodB ('abcde');
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.