Can existing RPG or COBOL programs be used as stored procedures?
Yes. DB2 UDB for iSeries supports external stored procedures, which allows existing high-level programs to be called as stored procedures. The CREATE PROCEDURE statement is used to register these programs as stored procedures. Back to questions • I do a CREATE PROCEDURE that contains SQL statements that reference user-defined functions. Before calling the procedure, I do a SET PATH so the functions are found. Why aren’t the functions found when I call the procedure? The SET PATH statement must be done before the CREATE PROCEDURE statement. The path for static statements in a precompiled program is determined when the program is created. In the case of CREATE PROCEDURE, we create an SQL C program. Dynamic statements in the procedure use the current path, but the static statements in the procedure use the path that was used at the time of creation. This is also true for the CREATE FUNCTION statement.