IBM Books

Building Applications for UNIX** Environments


Chapter 4. Building AIX Embedded SQL Applications

This chapter provides detailed information for building embedded SQL applications on AIX. In the script files, commands that begin with db2 are Command Line Processor (CLP) commands. Refer to the Command Reference if you need more information about CLP commands.

Considerations for running IBM and Micro Focus COBOL

Because of the way AIX loads stored procedures and resolves library references within them, there are requirements on how COBOL should be installed. These requirements become a factor when a COBOL program loads a shared library (stored procedure) at run time.

When a stored procedure is loaded, the chain of libraries it refers to must also be loaded. When AIX searches for a library only indirectly referenced by your program, it must use the path compiled into the library that referenced it when it was built by the language provider (IBM COBOL or Micro Focus COBOL). This path may very well not be the same path in which the compiler was installed. If the library in the chain cannot be found, the stored procedure load will fail, and you will receive SQLCODE -10013.

To ensure this does not happen, install the compiler wherever you want, then create symbolic links of all language libraries from the install directory into /usr/lib (a directory that is almost always searched when a library needs to be loaded). You could link the libraries into sqllib/function (the stored procedure directory), but this only works for one database instance; /usr/lib works for everyone on the machine. It is strongly recommended that you do not copy the libraries in; this especially applies to Micro Focus COBOL when multiple copies of the libraries exist.

A sample symbolic link of Micro Focus COBOL is provided below (assuming it is installed in /usr/lpp/cobdir):

    [1]> su root
    [2]> cd /usr/lib
    [1]> ln -sf /usr/lpp/cobdir/coblib/*.a .


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]

[ DB2 List of Books | Search the DB2 Books ]