You can compile a COBOL stored procedure using DB2 LUW.
- Compile the program you want to use as a stored procedure with the DB2 directive, just like any DB2 LUW program. Do this by adding a $SET statement to your program.
Note: If your program contains stored procedure CALL statements, you must specify the CALL_RESOLUTION DB2 directive to avoid an SQL0204 error.
- After the program has been added to the project, package it as a Dynamic Link Library (.dll).
- Click
Project >
Properties for your current project.
- Click
COBOL >
Link Settings.
- In the
Link with libs field, type
db2api.lib; then click
OK.
- Right-click the
.dll file; then click
Rebuild object from the context menu.
- From the
Rebuild object command, click
Project >
Deployment; then select the file and copy it to the
sqllib\function directory.