Tuesday, January 21, 2014

Java Calling AS400 RPG

Here is an example of a Java servlet executing a AS400 RPG program as a stored procedure call via JDBC. This is a simple "hello world" app to verify the DB connection and stored procedure functionality. On lines 47 and 48 of the Java code, parameters are given values to be sent to the RPG program. The stored procedure call is made on line 49 and, on lines 51 through 54, the values returned by the RPG program are retrieved and added to the session for display in the JSP. The JSP shows that the mixed case values sent to the RPG program were returned in upper case.