and compiling it using xlc -c FileOutput.c
The FileOutput.o file I am copying in the $DB2HOME/functions Dir.
and then creating a Stored procedure as follows:
CREATE PROCEDURE AKUMAR.FILE_OUTPUT
(IN FIELPATH VARCHAR(40),
IN FILETEXT VARCHAR(60)
RESULT SETS 1
READS SQL DATA
EXTERNAL NAME 'FileOutput.o!output_file'
PARAMETER STYLE GENERAL
CALLED ON NULL INPUT
PROGRAM TYPE SUB;
But this is not Working. Can any one of you through some light where I am going wrong. According to me it should work.
I'm not good with this, but is it not right that we just change the Stored Procedure compiler into the C compiler then code based on the C language, thus reducing the call from your stored procedure to an external program?
I may need to clarify the terms and make sure we are on the same ground.
When we create a SP in DB2, we are just defining the SP in DB2 catalog. This is basically defining SP attributes (eg fenced etc.). And also defining the program (in this case C) via the EXTERNAL to be run when the SP is called. The program will then have both SQLs, and C codes.