Call CL Or RPGLE Program In IBM ISeries Via Stored Procedure
Last Edited: 2018-05-31 16:00:57
Making a stored procedure in the IBM iSeries world takes a few steps in the way I was taught. Normally for our production environment we would use a version control product called Aldon. The way I'm going to show you uses IBM's PDM
to create a text file for DB2 to read, and then you run the query to create your stored procedure by running that text file through DB2.
First thing you're going to do is start up PDM and start a new...
/* DROP PROCEDURE FREDDYLIB/E1QPROC */
create procedure FREDDYLIB/E1QPROC(
IN P_CUST NUMERIC(7),
IN P_USER CHAR(
LANGUAGE RPGLE DETERMINISTIC NO SQL
EXTERNAL NAME WBLIB/E1CREINDEX
PARAMETER STYLE GENERAL
This example I used to call an RPG program directly. You could also call a CL by swapping out the RPGLE with CL. The NO SQL will make a difference if you plan to use SQLRPGLE or any other kinds of SQL in your program change. The NO SQL effectively stops any SQL from happening. You can simply omit it. I normally leave it off so I don't have issues later if I add SQL down the road as I normally will program using embedded SQL in SQLRPGLE so SQL is always available.