PreviousCOBSQL Interface to Oracle DBMSNext"

Chapter 27: Interface to Informix DBMS

This chapter describes how to access Informix database management systems with this COBOL system and how to compile and link COBOL programs containing their code.

27.1 Overview

You can access the SQL functions offered by the database system from your COBOL program by embedding SQL statements in your COBOL programs using the following format:


A preprocess step replaces statements of the above form with the relevant calls to database services. Other additions are made to the source code to bind host COBOL variables to the SQL variable names known to the database system.

The advantage of embedding SQL in this way is that you need not know the format of individual database routines. Informix preprocessors generate code to ensure that Animator is aware of the Informix run-time routines, but the source code used by Animator is the output from the precompiler rather than the original Embedded SQL. This disadvantage can be overcome by using the COBSQL integrated preprocessor (see the chapter Using COBSQL).

27.1.1 Software Requirements

Please consult on disk documentation for information about the compatibility of this COBOL System with the various database management systems and their precompilers.

27.1.2 Working with .int/.gnt Files and Informix

You can run your COBOL program containing Informix code in .int or .gnt code format. The Informix precompiler generates different code for each operating environment to enable this, so it is important to make sure that the correct precompiler switches are used. It is also important to ensure that the Informix support files are available to the COBOL run-time system

For DOS, mfsqlrtr.exe must be on the PATH, and sqlexit.gnt must be on the COBDIR path.

For Windows cdllsqlw.dll must be on the PATH, and sqlexit.gnt must be on the COBDIR path.

You also need the following COBOL system files to use the Informix database support:

applic.cfg* all
applic.exe* all
applic.lbr* all
cblsseg.dll Windows
cblwin.dll Windows
coblib.dle DOS
coblib.dlw Windows
coblib.dll OS/2
tools.lbr all
utils.lbr all
xm.exe DOS
* applic.cfg, applic.exe and applic.lbr are user-defined names for your application configuration, executable and library files.

DOS and Windows:
On DOS and Windows, you also need the ESQL/COBOL support files and I-Net or a local database. See the documentation supplied with your Informix product for details on the support files required.

On UNIX, you may animate and run .int and .gnt code by using a COBOL Run-time System that has been linked with the SQL run-time routines supplied by Informix.

You can build an Informix RTS with the makerun command which is described in the Informix ESQL/COBOL Programmer's Manual:

makerun newrun

To animate a program enter:

newrun animate myprog

27.2 Linking Informix Programs

Linking COBOL programs containing Informix code is described in the manuals supplied with ESQL/COBOL by Informix.

27.3 Filename Extensions

Informix uses .eco, .cob and .mf2 filename extensions. For the Micro Focus Copybook Preprocessor (CP) to resolve copybooks and include statements correctly, use the following COBOL Compiler directives:

osext (eco) copyext (mf2,cob,cpy,cbl)

27.4 Project Definition

You can use Workbench Organizer to create an Informix project (see the chapter Configuring Your Organizer Desktop in your Workbench User Guide). Typical values are:

Project name: Informix Demos
Environment Variables: cobcpy=c:\informix\incl;d:\apps\cpybook;
Working directory: c:\informix\sample\demo
Directives: osext(eco) copyext(cob,cpy,cbl) p(cobsql) p(cp)
Icon: project

27.5 COBSQL Directives

If you are using COBSQL you can use the cobsql.dir file to specify COBSQL directives. Typical values are shown below:


Copyright © 1999 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.

PreviousCOBSQL Interface to Oracle DBMSNext"