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



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?



Joe Pluta wrote:
We're going to have to get this into a FAQ, but for now there's a very
simple rule: if you define your data as type "A" in your prototype, RPG
will convert a Java byte array from ASCII to EBCDIC.  If you instead
define it as "3i 0", no conversion will occur.

This is the offender:


d getCDR          pr         65535a   extproc(*JAVA:CGF
d                                            :'getCDR')
d                                     varying


In your case, I think you want to do the following:

d getCDR          pr             3i 0 extproc(*JAVA:CGF
d                                            :'getCDR')
d                                     dim(32767)

Note that the max for DIM is 32767, at least at V5R1.  Also, I haven't
exactly tried this; I've only used it to pass a byte array back and
forth as a parameter.

Joe



From: Robert Upshall

I have a java class that receives UPD packets in ASCII.  I have tested
the class on a PC and the data written to the file stays intact in

ASCII

format. I am now happy with my class so I protoype it in RPG and

write

the same byte array to an iSeries PF. The problem is that a

conversion

of ASCII to EBCDIC occurs.  Where is this conversion taking place and
how do I stop it?

Here is the java method signature:

public byte[] getCDR(int len)

Here is the RPG prototype:

d getCDR          pr         65535a   extproc(*JAVA:CGF
d                                            :'getCDR')
d                                     varying
d len                           10i 0 value




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.