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



Hi Jon,

The last parameter to the createAccount() method is a boolean primitive. NOT the Boolean class. I realize that this is confusing -- but Java is a confusing language. When the name is lowercase "boolean" it refers to a primitive, which is a simple data type, like the ones we use in RPG. When it's capital, it's a object that's an instance of a class (you could think of an object as a sort of combination between a data structure and a module in RPG).

Since the Java method requires the primitive, you have to pass the primitive -- NOT the object.

To do that, you need to change your RPG prototype to pass an indicator (RPG's N data type) for the last parameter. Instead of passing the word 'False', pass RPG's *OFF.

Good luck


Jon S wrote:
Well I thought I had it working, but now I am stuck again. I am getting the following error:
Cause . . . . . : RPG procedure CG0001 in program GDSBILLBLD/CG0001 received
Java exception "java.lang.NoSuchMethodError: createAccount" when calling
method "createAccount" with signature
"(Ljava.lang.String;Ljava.util.Hashtable;Ljava.lang.String;Ljava.lang.Boolea
n;)V" in class "com.stalker.CGPro.CGProCLI".
Here is my call in RPG
createAccount(Conn:saccountName
:settings
:smailboxName
:FALSE);
And here is the java method and my prototype.
* void createAccount(String accountName, Hashtable settings, String
* accountType,boolean external)
D
D createAccount...
D PR ExtProc(*JAVA:CGConnectClass:
D 'createAccount')
* method parameters
D accountName O Class(*JAVA:'java.lang.String')
D Const
D settings O Class(*JAVA:'java.util.Hashtable'
D Const
D accountType O Class(*JAVA:'java.lang.String')
D Const
D external O Class(*JAVA:'java.lang.Boolean')
D Const
Any help would be greatly appreciated.
Jon> From: rvrratjon@xxxxxxxxxxx> To: rpg400-l@xxxxxxxxxxxx> Subject: RE: Calling Java from RPG> Date: Mon, 11 Feb 2008 19:01:22 +0000> > > That works. Thanks again Scott.> > > > Date: Mon, 11 Feb 2008 12:21:30 -0600> > From: rpg400-l@xxxxxxxxxxxxxxxx> > To: rpg400-l@xxxxxxxxxxxx> > Subject: Re: Calling Java from RPG> >> > Hi Jon.> >> >> One of the methods that I am calling has a parameter of a data type> >> hashtable. How on earth do I create that in RPG? Data Structure?> >> Array?> >> > The Hashtable parameter from your code snippet appears to be a Java> > object. From RPG, that'd be data type O, with the CLASS keyword to> > describe which Java class it refers to. You've already done this with> > the String data type in some of the previous code examples in this> > thread -- the only difference is that you'll want to use> > java.util.Hashtable in the CLASS keyword instead of the java.lang.String> > that you posted before.> >> > Personally, I prefer to create a standalone
variable like this:> >> > D Hashtable s O CLASS(*JAVA> > D :'java.util.Hashtable')> >> > Then, in your prototype for the Java method, you can declare the> > parameter as "like(Hashtable)". That way, you don't have to retype the> > whole CLASS thinggy on your prototype.> >> > You'll need to have a separate prototype for the Hashtable constructor,> > and another prototype for the "put" method in order to duplicate the> > code from the example you posted. The following code is untested, it's> > just off the top of my head, hopefully it'll give you an idea of what to do:> >> >> > D new_Hashtable pr like(Hashtable)> > D extproc(*JAVA> > D :'java.util.Hashtable'> > D :*CONSTRUCTOR)> >> > D Hashtable_put pr like(jObject)> > D extproc(*JAVA> > D :'java.util.Hashtable'> > D :'put')> > D key like(jObject) const> > D value like(jObject) const> >> > D settings s like(Hashtable)> >> > /free> >> > settings = new_Hashtable();> > Hashtable_put( settings> > : new_String('RealName')> > : new_
String('Jojn X. Smith') );> > Hashtable_put( settings> > : new_String('MaxAccountSize')> > : new_String('100K') );> >> > .> > .> > .> >> > CLI_createAccount( new_String('john@xxxxxxxxxxx')> > : settings> > : *NULL> > : FALSE );> >> > Hope that makes sense.> > --> > This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list> > To post a message email: RPG400-L@xxxxxxxxxxxx> > To subscribe, unsubscribe, or change list options,> > visit: http://lists.midrange.com/mailman/listinfo/rpg400-l> > or email: RPG400-L-request@xxxxxxxxxxxx> > Before posting, please take a moment to review the archives> > at http://archive.midrange.com/rpg400-l.> >> > _________________________________________________________________> Helping your favorite cause is as easy as instant messaging. You IM, we give.> http://im.live.com/Messenger/IM/Home/?source=text_hotmail_join> -- > This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list> To post a message email: RPG400-L@mi
drange.com> To subscribe, unsubscribe, or change list options,> visit: http://lists.midrange.com/mailman/listinfo/rpg400-l> or email: RPG400-L-request@xxxxxxxxxxxx> Before posting, please take a moment to review the archives> at http://archive.midrange.com/rpg400-l.>
_________________________________________________________________
Need to know the score, the latest news, or you need your Hotmail®-get your "fix".
http://www.msnmobilefix.com/Default.aspx


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.