3. Embedded SQL for COBOL : Preprocessor Operation : How to Incorporate Ingres into the Micro Focus RTS—UNIX : How to Build an Ingres RTS without the Ingres FRS
 
Share this page                  
How to Build an Ingres RTS without the Ingres FRS
If you are using the COBOL screen utilities and do not need to incorporate the Ingres forms runtime system (FRS) into your COBOL runtime support module, then you can link the RTS exclusively for database activity.
This section describes how to provide the COBOL RTS with all Ingres runtime routines.
Create a directory in which you want to store the Ingres‑linked RTS. For example, if the COBOL root directory is /usr/lib/cobol, you may want to add a new directory /usr/lib/cobol/ingres to store the Ingres/COBOL RTS. From that new directory, issue the commands that extract the Ingres Micro Focus support modules, link the Ingres COBOL RTS, and supply an alias to run the new program.
The shell script shown below performs all of these steps. Note that $II_SYSTEM refers to the path-name of the Ingres root directory on your system:
#
# These 2 steps position you to where you want to
# build the RTS
#
mkdir /usr/lib/cobol/ingres
cd /usr/lib/cobol/ingres
#
# Extract 2 Ingres Micro Focus COBOL support modules
#
ar xv $II_SYSTEM/ingres/lib/libingres.a iimfdata.o
ar xv $II_SYSTEM/ingres/lib/libingres.a iimflibq.o
#
# Now link the new Ingres COBOL RTS (this example
# calls it "ingrts")
#
cob -x -e "" -o ingrts \
  iimfdata.o iimflibq.o \
  $II_SYSTEM/ingres/lib/libingres.a \
  -lc -lm
#
# Provide an alias to run the new program
* (distribute to RTS users)
#
alias ingrts /usr/lib/cobol/ingrts
Ingres shared libraries are available on some UNIX platforms. To link with these shared libraries replace libingres.a in the cob command with:
-L $II_SYSTEM/ingres/lib -linterp.1 -lframe.1 -lq.1 \
     -lcompat.1
To verify if your release supports shared libraries check for the existence of any of these four shared libraries in the $II_SYSTEM/ingres/lib directory. For example:
ls -l $II_SYSTEM/ingres/lib/libq.1.*
Any user-defined handlers must also be incorporated into the Ingres/COBOL RTS, and should be added to the cob command line. For a detailed description, see Include User-Defined handlers in the Micro Focus RTS - UNIX (see page Include User-Defined Handlers in the Micro Focus RTS—UNIX) in this chapter.
Since the resulting RTS is quite large, the temporary holding directory required by COBOL may need to be reset. By default, this directory is set to /usr/tmp. If you are issued "out of disk space" errors during the linking of the Ingres/COBOL RTS, you should consult your COBOL Programmer's Reference Manual to see how to modify the TMPDIR environment variable.
You may need to specify other system libraries in addition to the -lm library on the cob command. The libraries required are the same as those need to link an embedded SQL/C program. The library names may be added to the last line of the cob command shown above. For example, if the inet and the inetd system libraries are required, the last line of the cob command would be:
-lc -lm -linet -linetd
At this point you are ready to run your embedded SQL/COBOL program.