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




Would he need to worry about converting his data from EBCDIC to ASCII
first if he passed his strings in as byte arrays?

Dan Feather

-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx
[mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of Barbara Morris
Sent: Thursday, August 03, 2006 1:15 PM
To: java400-l@xxxxxxxxxxxx
Subject: Re: Error calling constructor from RPG

Dan Feather wrote:

I do things a little differently than what you have here. I actually
define the string constructor as a procedure and create my own Java
string objects in RPG, and then pass those. So, my procedure
definition
in this case would look a little different than yours. Where you have:
D   source                       3A   CONST VARYING

I would have:
D   source                        O   CLASS(*JAVA : 'java.lang.String'
)


Dan, that's the correct way to prototype a String parameter, except I
would add CONST to the prototype.  

"3A" doesn't match a String object; it only matches a Java byte array. 
See Table 30 here:
http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/books_web/c0
925076171.htm#HDRINTRO_JAVA_RPG

Keith, rather than have your RPG program have to create all the String
objects to call your constructor with String parameters, it might be
easier to add another constructor to your Java classwith byte array
parameters, for your RPG programs to use.  Then your RPG program could
use the prototype with the A-type parameters.

Your extra constructor can call through to the other constructor using
"this" as the method name.

        // the constructor with byte[] parameters
        public MessageOut(int comp, int dept, byte[] source,
                byte[] groupCode, byte[] jobCode, byte[] pkgLib) {
            this(comp, dept, 
                 new String(source), new String(groupCode), 
                 new String(jobCode), new String(pkgLib));
        }


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.