|
Is there any way to stop this conversion when using a varying chr field?
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 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.