Micro Focus Server Express™

Database Access


Issue 1
January 1999

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

MERANT has made every effort to ensure that this manual is correct and accurate but reserves the right to make changes without notice at its sole discretion at any time.

The software described in this document is supplied under a license and may be used or copied only in accordance with the terms of such license, and in particular any warranty of fitness of MERANT software products for any particular purpose is expressly excluded and in no event will MERANT be liable for any consequential losses.

Micro Focus® is a registered trademark and Form Designer™, MERANT™, Micro Focus COBOL™ and Server Express™ are trademarks of MERANT International Limited.

UNIX® is a registered trademark of X/Open Company Limited.

Oracle® is a registered trademark of Oracle Corporation.

Informix® is a registered trademark of Informix Corporation

Sybase™ is a trademark of Sybase, Inc.

Microsoft®, Windows®, and Windows for Workgroups®, are registered trademarks of Microsoft Corporation.

Visual Basic™ and Windows NT™ are trademarks of Microsoft Corporation

IBM® and DB2® are registered trademarks of International Business Machines Corporation.

Copyright© 1999 MERANT
All Rights Reserved


This book describes how you can use Server Express to create a COBOL application that uses embedded SQL to access a relational database.

Note: Use of COBSQL is only supported for standard procedural COBOL programs. You cannot use COBSQL with Object Oriented COBOL syntax (OO programs) or with nested programs.


This book is for Server Express COBOL programmers who want to create or modify COBOL applications which access relational databases using embedded SQL.

It is assumed that you are already familiar with SQL. You should also be familiar with the relational database you will be accessing, including the configuration of any client software that may be needed.

How to Use this Manual

Part One - Introduction

Chapter One, Introduction, gives a brief overview of embedded SQL and explains how you can build an embedded SQL application.

Chapter Two, Host Variables, describes host variables, host arrays, indicator variables and indicator arrays, and how they are used.

Chapter Three, Data Types, explains which data types are supported and how to map the data types used by a particular database to the correct COBOL picture clause.

Chapter Four, Cursors, details how to declare and open a cursor and how to use it to retrieve data.

Chapter Five, Data Structures, describes the SQLCA (SQL Communications Area) and the SQLDA (SQL Descriptor Area).

Chapter Six, Dynamic SQL, explains how to prepare and execute dynamic SQL.

Part Two - OpenESQL

Chapter Seven, OpenESQL, gives an overview of OpenESQL and how it works.

Part Three - DB2

Chapter Eight, DB2, describes the DB2 ECM and how it is used.

Part Four - COBSQL

Chapter Nine, COBSQL, documents the COBSQL preprocessor explaining how it is used.

Part Five - Appendices

Appendix A, Reserved Keywords, lists the keywords reserved for use by OpenESQL and ODBC.

Appendix B, COBSQL Error Messages, lists current COBSQL messages.

Appendix C, Connect ODBC UNIX Help, provides information on ODBC.

Appendix D, Embedded SQL Statements, lists the syntax and an example for each embedded SQL statement.

Appendix E, The CP Preprocessor, discusses the CP preprocessor.


MERANT was formed by combining Micro Focus and INTERSOLV. All reference to the companies Micro Focus or INTERSOLV in this book should now be taken to mean MERANT. Micro Focus is retained as the family name for the Micro Focus product set produced by MERANT.


The following type styles and conventions have been used in this book: