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



<Richard>
Rather than calling RPG at all depending on the process, it might be better to write a Java Program/Class and wrap a CL program or command around it.
We do this quite successfully. QSH and PASE get called in the background which is the equivalent of a new JVM being initiated.
We had problems with our RPG/Java mix programs at V7R1 and eliminated RPG from the mix for those.
</Richard>

JNI (Java native interface) was not designed to write mixed applications and the RPG implementation of JNI is really buggy. But your approach to call a Java main from CL in a SBMJOB has severe limitations too. A Java main could only return an integer and all of your Java classes are stateless, as they are initialized at every call and last not least, you are starting a JVM for every call, which would not scale well and is rather expensive on AS/400.

I recommend an asynchronous approach with a prestarted JVM, sitting on a DataQ (or something similar), waiting for incoming calls with some data as parameter, returning some data as response to the calling AS/400 native programm. AppServer4RPG is a sort of extensible Framework to accomplish this. To implement a call of a Java normal non static method, you would need a so called EventHandler and two PORDS2POJO Beans for the incoming and outgoing DataStructure and an entry to the configuration.

AppServer4RPG provides some Session Handling for your EventHandlers and the complete DataQ Handling, it's open source and available at SourceForge. If you would need diffrent JVM configurations, you could easyly start multiple instances of AppServer4RPG, each of them supporting multiple clients at the same time; once started it reacts very fast. To play around with AppServer4RPG you could install ArdGate, an universal database driver to access JDBC databases from AS/400 native SQL interfaces; ArdGate is an application using AppServer4RPG as its base layer.

D*B

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.