Compiling and linking a PL/I stored procedure using DB2 LUW is a bit different than compiling and linking most PL/I applications. Use this procedure to compile and link DB2 stored procedures under DB2 LUW.
mfplx -sql db2 -optsql DB=SAMPLE getprml.pli -nolaxdcl –ppsql -c
Windows:
To link the program as a Dynamic Link Library (.dll), you use CBLLINK rather than the normal PL/I link command.
To link a PL/I DB2 stored procedure, you must link extra modules so that DB2 LUW can load the PL/I run time and load the PL/I routine properly.
If the stored procedure is not defined with OPTIONS(MAIN), add the systemsql.obj and setupdeffiles.obj object modules, as well as the mfplimd.lib and the 32-bit db2api.lib library files to the link command. For example:
cbllink /d /V /K GETPRML.obj db2api.lib mfplimd.lib systemsql.obj setupdeffiles.obj
If the stored procedure is defined with OPTIONS(MAIN), link these additional modules in the link command:
For example:
cbllink /d /V /K GETPRML.obj db2api.lib mfplimd.lib mfexttbl.lib systemsql.obj setupdeffiles.obj lpimainstub.obj lpimain.obj
Copy the stored procedure object that is produced to the function directory under your DB2 instance.
Execute db2stop, copy the DLL, then execute db2start from a DB2 administrative command prompt.
Execute the following command from a DB2 command prompt:
db2 update dbm cfg using KEEPFENCED NO
Executing this command in a production environment has a significant performance impact, so it should not be used. Refer to your IBM documentation for more information on this command.