ALLBASE/SQL COBOL Application Programming Guide : COPYRIGHT NOTICE [ ALLBASE/SQL COBOL Application Programming Guide ] MPE/iX 5.0 Documentation
ALLBASE/SQL COBOL Application Programming Guide
900 Series HP 3000 Computer Systems
ALLBASE/SQL COBOL
Application Programming Guide
HP Part No. 36216-90006
Printed in U.S.A.
Edition Fourth Edition
E0692
________________________________________________________________________
|The information contained in this document is subject to change |
|without notice. |
| |
|Hewlett-Packard makes no warranty of any kind with regard to this |
|material, including, but not limited to, the implied warranties of |
|merchantability or fitness for a particular purpose. Hewlett-Packard |
|shall not be liable for errors contained herein or for direct, |
|indirect, special, incidental or consequential damages in connection |
|with the furnishing or use of this material. |
| |
|Hewlett-Packard assumes no responsibility for the use or reliability |
|of its software on equipment that is not furnished by Hewlett-Packard.|
| |
|This document contains proprietary information which is protected by |
|copyright. All rights are reserved. Reproduction, adaptation, or |
|translation without prior written permission is prohibited, except as |
|allowed under the copyright laws. |
________________________________________________________________________
Copyright (c) 1987, 1988, 1989, 1990, 1991, 1992 by Hewlett-Packard Company
________________________________________________________________________
|Use, duplication, or disclosure by the U.S. Government is subject to |
|restrictions as set forth in subparagraph (c) (1) (ii) of the Rights |
|in Technical Data and Computer Software clause at DFARS 252.227-7013. |
|Rights for non-DoD U.S. Government Departments and agencies are as set|
|forth in FAR 52.227-19 (c) (1,2). |
| |
|Hewlett-Packard Company |
|3000 Hanover Street |
|Palo Alto, CA 94304 U.S.A. |
________________________________________________________________________
Restricted Rights Legend
Printed 1992
Printing History
The following table lists the printings of this document, together with
the respective release dates for each edition. The software version
indicates the version of the software product at the time this document
was issued. Many product releases do not require changes to the
document. Therefore, do not expect a one-to-one correspondence between
product releases and document editions.
Edition Date Software Version
---------------------------------------------------------------------------------------
First Edition December 1987 36216-02A.01.00
Second Edition October 1988 36216-02A.12.00
Third Edition October 1989 36216-02A.20.00
Fourth Edition June 1992 36216-02A.E1.00
Preface
ALLBASE/SQL is a relational database management system for use on HP 3000
Series 900 computers. ALLBASE/SQL (Structured Query Language) is the
language you use to define and maintain data in an ALLBASE/SQL
DBEnvironment. This manual presents the techniques of embedding
ALLBASE/SQL within COBOL language source code.
This manual is intended as a learning tool and a reference guide for
COBOL programmers. It presumes the reader has a working knowledge of
COBOL, the MPE/iX operating system, and ALLBASE/SQL relational database
concepts.
MPE/iX, Multiprogramming Executive with Integrated POSIX, is the latest
in a series of forward-compatible operating systems for the HP 3000 line
of computers. In HP documentation and in talking with HP 3000 users, you
will encounter references to MPE XL, the direct predecessor of MPE/iX.
MPE/iX is a superset of MPE XL. All programs written for MPE XL will run
without change under MPE/iX. You can continue to use MPE XL system
documentation, although it may not refer to features added to the
operating system to support POSIX (for example, hierarchical
directories).
This manual contains both basic and in-depth information about embedding
ALLBASE/SQL. Code examples are based, for the most part, on the sample
database, PartsDBE, which accompanies ALLBASE/SQL. Refer to Appendix C in
the ALLBASE/SQL Reference Manual for information about the structure of
PartsDBE and for listings of the sample database.
* Chapter 1, "Getting Started with ALLBASE/SQL Programming in
COBOL," is an introduction to ALLBASE/SQL programming which
includes information on developing, using, and maintaining
programs on the MPE XL operating system.
The remaining chapters focus primarily on embedding SQL commands in COBOL
application programs.
* Chapter 2, "Using the ALLBASE/SQL COBOL Preprocessor," explains
the ALLBASE/SQL preprocessor and how to invoke it.
* Chapter 3, "Embedding SQL Commands," gives rules on where and how
to embed SQL commands.
* Chapter 4, "Host Variables," describes how to define and use
variables to transfer data between your COBOL program and an
ALLBASE/SQL DBEnvironment.
* Chapter 5, "Runtime Status Checking and the SQLCA," defines ways
to monitor and handle successful and unsuccessful SQL command
execution.
Chapters 6 through 13 address the various ways to manipulate data in an
ALLBASE/SQL COBOL program.
* Chapter 6, "Overview of Data Manipulation," is an overview of data
manipulation and the techniques for executing data manipulation
commands.
* Chapter 7, "Simple Data Manipulation," explains how to operate on
one row at a time.
* Chapter 8, "Processing with Cursors," explains the use of a cursor
to process a multiple row query result one row at a time.
* Chapter 9, "BULK Table Processing," examines the processing of
multiple rows at a time.
* Chapter 10, "Using Dynamic Operations," covers the use of
ALLBASE/SQL commands that are preprocessed at runtime.
* Chapter 11, "Programming with Constraints," discusses ways to
ensure the integrity of your data.
* Chapter 12, "Programming with LONG Columns," shows how to use
columns much longer than regular columns.
* Chapter 13, "Programming with ALLBASE/SQL Functions," describes
ALLBASE/SQL functions, including date/time functions and Tuple
Identification (TID) functions.
Chapters 2, 3, 5, 7 through 10, and chapter 13 contain sample programs
for use with the sample database.
Conventions
UPPERCASE In a syntax statement, commands and keywords are
shown in uppercase characters. The characters
must be entered in the order shown; however, you
can enter the characters in either uppercase or
lowercase. For example:
COMMAND
can be entered as any of the following:
command Command COMMAND
It cannot, however, be entered as:
comm com_mand comamnd
italics In a syntax statement or an example, a word in
italics represents a parameter or argument that
you must replace with the actual value. In the
following example, you must replace filename with
the name of the file:
COMMAND filename
bold italics In a syntax statement, a word in bold italics
represents a parameter that you must replace with
the actual value. In the following example, you
must replace filename with the name of the file:
COMMAND(filename)
punctuation In a syntax statement, punctuation characters
(other than brackets, braces, vertical bars, and
ellipses) must be entered exactly as shown. In
the following example, the parentheses and colon
must be entered:
(filename):(filename)
underlining Within an example that contains interactive
dialog, user input and user responses to prompts
are indicated by underlining. In the following
example, yes is the user's response to the prompt:
Do you want to continue? >> yes
{ } In a syntax statement, braces enclose required
elements. When several elements are stacked
within braces, you must select one. In the
following example, you must select either ON or
OFF:
COMMAND { ON }
{ OFF}
[ ] In a syntax statement, brackets enclose optional
elements. In the following example, OPTION can be
omitted:
COMMAND filename [OPTION]
When several elements are stacked within brackets,
you can select one or none of the elements. In
the following example, you can select OPTION or
parameter or neither. The elements cannot be
repeated.
COMMAND filename [ OPTION ]
[ parameter]
Conventions (continued)
[...] In a syntax statement, horizontal ellipses
enclosed in brackets indicate that you can
repeatedly select the element(s) that appear
within the immediately preceding pair of brackets
or braces. In the example below, you can select
parameter zero or more times. Each instance of
parameter must be preceded by a comma:
[,parameter][...]
In the example below, you only use the comma as a
delimiter if parameter is repeated; no comma is
used before the first occurrence of parameter:
[parameter][,...]
|...| In a syntax statement, horizontal ellipses
enclosed in vertical bars indicate that you can
select more than one element within the
immediately preceding pair of brackets or braces.
However, each particular element can only be
selected once. In the following example, you must
select A, AB, BA, or B. The elements cannot be
repeated.
{ A} |...|
{ B}
... In an example, horizontal or vertical ellipses
indicate where portions of an example have been
omitted.
In a syntax statement, the space symbol shows a
required blank. In the following example,
parameter and parameter must be separated with a
blank:
(parameter) (parameter)
The symbol indicates a key on the keyboard. For
example, RETURN represents the carriage return key
or Shift represents the shift key.
CTRLcharacterCTRLcharacter indicates a control character. For
example, CTRLY means that you press the control
key and the Y key simultaneously.
MPE/iX 5.0 Documentation