Copyright © 1998 Micro Focus Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.
Micro Focus 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 Micro Focus software products for any particular purpose is expressly excluded and in no event will Micro Focus be liable for any consequential losses.
Micro Focus® is a registered trademark and Form Designer, Micro Focus COBOL and NetExpress are trademarks of Micro Focus Limited.
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.
UNIX® is a registered trademark of X/Open Company Limited.
Oracle® is a registered trademark of Oracle Corporation.
Sybase is a trademark of Sybase, Inc.
Copyright© 1987-1998 Micro Focus
All Rights Reserved.
This book describes how you can use NetExpress to create a COBOL application which uses embedded SQL to access a relational database. NetExpress provides:
OpenESQL is an embedded SQL preprocessor which enables you to access ODBC-enabled data sources by embedding SQL statements within your COBOL program.
The DB2 External Checker Module (ECM) is a new type of integrated preprocessor provided with NetExpress and designed to work closely with the Micro Focus COBOL Compiler. The DB2 ECM converts embedded SQL statements into the appropriate calls to DB2 database services. It is intended for use with:
COBSQL is an integrated preprocessor designed to work with COBOL precompilers supplied by relational database vendors. It is intended for use with:
You should use COBSQL if you are already using either of these precompilers with an earlier version of a Micro Focus COBOL product and want to migrate your application to NetExpress, or if you are creating applications that will be deployed on UNIX platforms. For any other type of embedded SQL development, we recommend that you use OpenESQL.
This book is for NetExpress 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 both SQL and, if you are using OpenESQL, ODBC. If you are using the DB2 ECM, it is assumed that you are familiar with DB2. If you are using COBSQL, it is assumed that you are familiar with the Oracle or Sybase database that you are accessing.
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.
Chapter Eight, OpenESQL Assistant, is a tutorial which shows how you can use the OpenESQL Assistant to quickly and easily prototype SQL statements. Once you are happy with the SQL query you have created, the OpenESQL Assistant will insert the query into your program. It can also add required auxiliary code such as the CONNECT statement and host variable declarations.
Part Three - DB2
Chapter Nine, DB2, describes the DB2 ECM and how it is used.
Part Four - COBSQL
Chapter Ten, COBSQL, documents the COBSQL preprocessor explaining how it is used.
The following type styles and conventions have been used in this book:
cat script_name | more
The italic text denotes a variable that you type as part of the command.
column_nameis like the
pattern_value, or is not like the
pattern_value, depending on the absence or presence of the optional word
column_name [NOT] LIKE pattern_value
This paragraph only applies to OpenESQL and not to DB2 or COBSQL.