×
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.
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.
As an Amazon Associate we earn from qualifying purchases.