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



Barbara & Dan, thanks for your assistance.

I added an extra constructor that's called from the RPG where the Strings
are replaced by byte arrays as Barbara described below. The RPG call now
recognises the method signature and runs fine.

I have a second class which I'd like to call from RPG. It runs fine when
called from Qshell but behaves unexpectedly when called from RPG. The class
sends an MQ message. 

I'd like to track the logic when called from RPG by adding some
System.out.println markers so my question is: how can I view this output?

I don't want a screen break to the Java shell but would like the output
redirected to a file which could be either a QSYS physical file or a text
file in the IFS. If possible I'd prefer redirection by an override in the
job environment rather than amending Java source but can do that if now
other way.

Thanks,

Keith
 



 

-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx]

Sent: 03 August 2006 19:15
To: java400-l@xxxxxxxxxxxx
Subject: Re: Error calling constructor from RPG

*** WARNING : This message originates from the Internet ***

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/c09250
76171.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));
        }

--
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L)
mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe,
unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at http://archive.midrange.com/java400-l.



The Royal Bank of Scotland plc, Registered in Scotland No. 90312. Registered 
Office: 36 St Andrew Square, Edinburgh EH2 2YB

Authorised and regulated by the Financial Services Authority.

This e-mail message is confidential and for use by the addressee only. If the 
message is received by anyone other than the addressee, please return the 
message to the sender by replying to it and then delete the message from your 
computer. Internet e-mails are not necessarily secure. The Royal Bank of 
Scotland plc does not accept responsibility for changes made to this message 
after it was sent.

Whilst all reasonable care has been taken to avoid the transmission of viruses, 
it is the responsibility of the recipient to ensure that the onward 
transmission, opening or use of this message and any attachments will not 
adversely affect its systems or data. No responsibility is accepted by The 
Royal Bank of Scotland plc in this regard and the recipient should carry out 
such virus and other checks as it considers appropriate.


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.