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



Robert Upshall wrote:
> 
> The problem with this approach is that the byte array returned is of
> varying length, and I need to know the varying length, with a char I can
> determine the size in rpg with the %len with the integer array this is
> not possible.
> 
> Is there any way to stop this conversion when using a varying chr field?
> 

No, there's no way to stop it currently.  I think you have a few
options:

1. Keep your current prototype and translate it back from Ebcdic to
Ascii.  (But I don't know if 100% turnaround is possible for every
character of every CCSID-pair.)

2. Prototype it in RPG as returning a 3i 0 array and search the returned
value for a zero element (this assumes you would never have a zero byte
in the Ascii array).

2b. Add another method in your Java class to return the length of the
byte array, so you don't have to search for the end of the string.  Or
you could add another Integer-object parameter to your Java method where
you can return the length of the array.

3. Since a Java array is also a Java Object, modify your Java method to
return an Object (or write a wrapper method), change your RPG prototype
to return java.lang.Object, and handle getting the array data yourself
using JNI calls.

     Object myMethod ()
     {
        byte byteArr[];
        ...
        return byteArr;
     }

Your RPG code to get the array data will /COPY QSYSINC/QRPGLESRC,JNI,
and call these JNI functions 
   GetArrayLength
   GetByteElements
   ReleaseByteArrayElements
If you Google for these functions, you should see some C examples which
should get you started.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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.