Previous Topic Next topic Print topic


Compiling Stored Procedures under DB2 LUW

You can compile a COBOL stored procedure using DB2 LUW.

  1. 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.
  2. After the program has been added to the project, package it as a Dynamic Link Library (.dll).
  3. Click Project > Properties for your current project.
  4. Click COBOL > Link Settings.
  5. In the Link with libs field, type db2api.lib; then click OK.
  6. Right-click the .dll file; then click Rebuild object from the context menu.
  7. From the Rebuild object command, click Project > Deployment; then select the file and copy it to the sqllib\function directory.
Previous Topic Next topic Print topic