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



Hooray, it works. Amazingly, it worked the first time after I got it compiled successfully. Basically, my code consists of 4 lines.

jTokenKey = makeString(KeyV);
jTokenExpireMinutes = 2;
TokenRet = getUniversalToken( jTokenKey : jTokenExpireMinutes);
Token = getBytes(TokenRet);

Do I need to worry about garbage collection if the process is called multiple times within a job or is that handled for me? From what I understand, a new string object would be created each time the program is called. Should I set on LR each time it is called or doesn't that make any difference other than from a performance standpoint?

Dean Eshleman,
Everence Financial

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Barbara Morris
Sent: Wednesday, September 19, 2012 7:10 PM
To: rpg400-l@xxxxxxxxxxxx
Subject: Re: Calling Java from RPG take 2

On 2012/9/19 4:47 PM, Dean Eshleman wrote:

String tokenValue = cincom.eloquence.exits.gsm.token. UniversalToken.
getUniversalToken(Mykey, expireMinutes)
...
What I am struggling with is how do I move data between a Java string
variable and an RPG character variable?


You'd use the String constructor to create a Java string from an RPG
character variable, and you'd use the getBytes method from the Java
String class to get the Java string data into an RPG character variable.

The RPG/Java trouble-shooting guide http://ibm.biz/BdxjTE, in the RPG
Cafe, has the code for a program JAVAPROP that has something very
similar to what you would be doing.

It's calling Java method
String System.getProperty (String);
so it has to build the String parameter, and then get the value back
from the returned value.

beginObjGroup (env : 100);
str = newString (prop);
str = getProperty (str);
if str = *null;
result = 'That property was not found';
else;
result = getBytes (str);
endif;
endObjGroup (env);

The RPG Cafe also has a savefile with source for the JNI utilities in
the ILE RPG Programmer's Guide, to make it easy to call JNI functions
like BeginObjGroup and endObjGroup which are essential for enabling Java
garbage collection. Find the article called "JNI utilities from the RPG
Programmer's Guide" in the left-hand navigation of the wiki that you'll
get to from the trouble-shooting link.

As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.