I have been perusing the CA Plex for Java platform manual. The front page is promising: Java Client Application calls RPG/400 in iSeries. However, the manual seems to be built on the idea that the Java Client Application is coded using Plex and server functions are called from Plex environment. But we plan to call server functions from hand coded Java.
I can call RPG programs from Java as follows:
import com.ibm.javart.calls.PowerServer;
import com.ibm.javart.calls.PowerServerImpl;
public void test() {
PowerServer myPowerServer = null;
try {
myPowerServer = new PowerServerImpl();
RPGPRGWrapper wrapper = new RPGPRGWrapper(myPowerServer);
wrapper.execute();
System.out.println("result: " + wrapper.getEnvironment());
}
catch (Exception e) {
System.out.println(e.getMessage());
}
}
There are probably other ways to call RPG programs as well, but this has worked for us when calling COBOL programs and I assume RPG programs can be called similarly. Writing the wrapper has to be created manually from an interface, but it is trivial with our development tools. We'll only need to take care of library list on the iSeries.
This is through jt400, not Plex610 dispatcher. If I use Plex610 dispatcher I get error
CPD0018 String ' ' contains a character that is not valid so apparently this is not the correct way to call the program. The question is, is the any added value in calling the program through Plex610 dispatcher instead of just calling RPG using jt400? And, in case there is, how do I call it from hand-written Java?