Working with Stored Procedures

Important: Any machine on which a PL/I stored procedure is executed must have a Micro Focus Enterprise Server product installed and licensed. Contact Customer Care for more information.

To get a stored procedure up and running:

  1. To set up the initial environment:
    On Windows, do one of the following:
    1. Add your installation's executable (bin) directory to the PATH statement.
    2. Copy the following DLLs to the directory from which you execute the stored procedure. You need to do this for DB2 to be able to execute a PL/I stored procedure:
      • cblrtsm.dll
      • mffh.dll
      • mfhcolib.dll
      • mfsqlsmf.dll
      • cblctf.dll
      • dbghelp.dll
      • libxml2.dll
      • mfplimd.dll
      • mplicppm.dll
      • mpliemsg.lng
      • plidump.dll
      • xerces-c_2_8.dll

    In addition, see the IBM documentation for Building Micro Focus COBOL Routines on Windows.

    On UNIX, see the IBM documentation for Building Micro Focus COBOL Routines on UNIX.

  2. Code and prepare a stored procedure. See Writing and Preparing Stored Procedures for instructions.
  3. Code and prepare an application that calls the stored procedure. An SQL statement, CALL, in that application must use the same parameter list and linkage convention as the stored procedure that it invokes. See Writing and Preparing Applications to Use Stored Procedures for instructions.
  4. Define your stored procedure to the DB2 LUW Server by issuing a CREATE PROCEDURE command, which will place a row in the appropriate system table(s). See Defining Stored Procedures under DB2 LUW for additional details.
  5. Compile and link your stored procedure. See Compiling and Linking Stored Procedures under DB2 LUW for additional details.
  6. Debug and test your stored procedure. See Debugging Stored Procedures under DB2 LUW for additional details.