Configuring the Micro Focus COBOL compiler on Linux

To run Micro Focus COBOL routines, you must ensure that the Linux® runtime linker and Db2® processes can access the dependent COBOL libraries in the /usr/lib directory.

About this task

Create symbolic links to /usr/lib for the COBOL shared libraries as root. The simplest way to create symbolic links to /usr/lib is to link all COBOL library files from $COBDIR/lib to /usr/lib:
   ln -s $COBDIR/lib/libcob* /usr/lib
where $COBDIR is where Micro Focus COBOL is installed, usually /opt/lib/mfcobol.
Here are the commands to link each individual file (assuming Micro Focus COBOL is installed in /opt/lib/mfcobol):
   ln -s /opt/lib/mfcobol/lib/libcobrts.so /usr/lib
   ln -s /opt/lib/mfcobol/lib/libcobrts_t.so /usr/lib
   ln -s /opt/lib/mfcobol/lib/libcobrts.so.2 /usr/lib
   ln -s /opt/lib/mfcobol/lib/libcobrts_t.so.2 /usr/lib
   ln -s /opt/lib/mfcobol/lib/libcobcrtn.so /usr/lib
   ln -s /opt/lib/mfcobol/lib/libcobcrtn.so.2 /usr/lib
   ln -s /opt/lib/mfcobol/lib/libcobmisc.so /usr/lib
   ln -s /opt/lib/mfcobol/lib/libcobmisc_t.so /usr/lib
   ln -s /opt/lib/mfcobol/lib/libcobmisc.so.2 /usr/lib
   ln -s /opt/lib/mfcobol/lib/libcobmisc_t.so.2 /usr/lib
   ln -s /opt/lib/mfcobol/lib/libcobscreen.so /usr/lib
   ln -s /opt/lib/mfcobol/lib/libcobscreen.so.2 /usr/lib
   ln -s /opt/lib/mfcobol/lib/libcobtrace.so /usr/lib
   ln -s /opt/lib/mfcobol/lib/libcobtrace_t.so /usr/lib
   ln -s /opt/lib/mfcobol/lib/libcobtrace.so.2 /usr/lib
   ln -s /opt/lib/mfcobol/lib/libcobtrace_t.so.2 /usr/lib
The following procedures need to be done on each Db2 instance:

Procedure

  • When you precompile your application using the PRECOMPILE command, use the target mfcob option.
  • You must include the Db2 COBOL COPY file directory in the Micro Focus COBOL environment variable COBCPY. The COBCPY environment variable specifies the location of the COPY files. The Db2 COPY files for Micro Focus COBOL reside in sqllib/include/cobol_mf under the database instance directory.
    To include the directory, enter:
    • On bash or Korn shell:
      export COBCPY=$HOME/sqllib/include/cobol_mf:$COBDIR/cpylib
    • On C shell:
         setenv COBCPY $HOME/sqllib/include/cobol_mf:$COBDIR/cpylib
  • Update the environment variable:
    • On bash or Korn shell:
         export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/sqllib/lib:$COBDIR/lib 
    • On C shell:
         setenv LD_LIBRARY_PATH $LD_LIBRARY_PATH:$HOME/sqllib/lib:$COBDIR/lib
  • Set the Db2 Environment List:
       db2set DB2ENVLIST="COBDIR LD_LIBRARY_PATH"

Results

Note: You might want to set COBCPY, COBDIR, and LD_LIBRARY_PATH in the .bashrc, .kshrc (depending on shell being used), .bash_profile, .profile (depending on shell being used), or in the .login. .