PreviousInterface to Oracle DBMS File StructuresNext"

Chapter 29: Interface to Sybase DBMS

This chapter describes how to use Sybase in this COBOL system and how to compile and link COBOL programs containing their code. It also describes the COBOL to Sybase integration package, explaining how to use it.

29.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 then 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 the programmer need not know the format of individual database routines. The disadvantage is that the resulting source code must be linked to the database routines, and therefore Animator using .int and .gnt code variants are unavailable. The COBOL to Sybase integration package described later in this chapter overcomes this limitation, but the source code used by Animator is the output from the precompiler rather than the original Embedded SQL written by the programmer. This disadvantage can be overcome by using the COBSQL integrated preprocessor (see the chapter Using COBSQL).

29.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.

29.1.2 Working with .int/.gnt Files

You can run your COBOL program containing Sybase code in .int or .gnt code format. To make Sybase calls accessible to COBOL programs in .int or .gnt code format, you must use the syblib interface module to resolve the calls from COBOL to Sybase.

The COBOL to Sybase integration package, consists of:

syblib.gnt main integration library

syblib.cbl source code for syblib

syblib simply loads the appropriate Sybase DLL. The source code is supplied in case Sybase change their DLL names in a future release.

For Windows the Sybase DLL is called wcobct.dll

16-bit OS/2:
16 bit OS/2 applications are not supported.

32-bit OS/2:
For 32 bit OS/2 applications the name is cobct.dll.

You also need the Open Client Embedded SQL/Cobol support files and Open Client or a local database. See the documentation supplied with your Sybase product for details on the support files required.

On UNIX you can 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 Sybase.

You should use the makefile supplied by Sybase to rebuild the COBOL run-time system to include Sybase support.

29.2 Linking Sybase Programs

Linking COBOL programs containing Sybase code is described in the manuals supplied with Open Client Embedded SQL/COBOL by Sybase.

29.2.1 Loading a COBOL to Sybase Interface Module

You can load a COBOL to Sybase Interface Module in any of the following ways:

Note: If you use either of the first two methods, ensure that only the top-level program calls the syblib interface module. Do not compile a subprogram with the INITCALL directive. Using COBOL Configuration Files

If you are using the Build utility, you can load your syblib file from your application configuration file. To do so, you must add the following information to your .cfg file:


Note: applic.lbr is a user-defined name for the user application library file.

29.3 Filename Extensions

Sybase uses .pco and .cbl filename extensions. For the Micro Focus Copybook Preprocessor (CP) to resolve copybooks and include statements correctly, use the following COBOL Compiler directives:


29.4 Project Definition

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

Project name: Sybase Demos
Environment Variables: cobcpy=e:\sql10\include;d:\apps\cpybook;
Working directory: e:\sql10\sample\esqlcob
Directives: osext(eco) p(cobsql) p(cp) sy
Icon: project

29.5 COBSQL Directives

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


29.6 COBSQL and Sybase Considerations

If you are using COBSQL in conjunction with the Sybase precompiler, you should bear in mind the following points.

For more information on how Sybase uses and locates the different error message files, refer to your Sybase documentation.

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

PreviousInterface to Oracle DBMS File StructuresNext"