I have written a SQL stored procedure
and I have to call that SQL stored procedure
in the CL program
. I am facing an issue in calling the SQL stored procedure from the CL program. I can call it using the SQL CALL statement
in the RPG program but I can not use the same SQL CALL statement in the CL program by any means, I tried calling it using the procedure call as we call CL or RPG program but that again did not work and caused MCH3601
. This is my SQL stored procedure script that takes two input parameters only and inserts data in a table.
CREATE OR REPLACE PROCEDURE STORED33B(
IN P_NAME CHAR(20),
IN P_GENDER CHAR(1)
)
SPECIFIC STORED33B
BEGIN
INSERT INTO PF8_D(NAME,GENDER) VALUES(P_NAME,P_GENDER);
END
Is there any way using which I can call an SQL stored procedure from within the CL program?
We can call SQL stored procedure from within the CL program using the
QZDFMDB2
program which is thedatalink file manager DB2 CLP program
present in theQSYS
library.We need to build the command string which is the SQL stored procedure CALL statement with the required parameter. Later we pass that command string to the program
qzdfmdb2
which executes SQL interactively from within the CL program.