[an error occurred while processing this directive]

HP OpenVMS Systems Documentation

Content starts here

HP COBOL
DBMS Database Programming Manual


Previous Contents Index

Reader's Comments

HP welcomes your comments on this manual. Please send comments to either of the following addresses:

Internet openvmsdoc@hp.com
Postal Mail Hewlett-Packard Company
OSSG Documentation Group, ZKO3-4/U08
110 Spit Brook Rd.
Nashua, NH 03062-2698

How to Order Additional Documentation

For information about how to order additional documentation, visit the following World Wide Web address:


http://www.hp.com/go/openvms/doc/order

Conventions

The following product names may appear in this manual:

  • HP OpenVMS Industry Standard 64 for Integrity servers
  • OpenVMS I64
  • I64

All three names---the longer form and the two abbreviated forms---refer to the version of the OpenVMS operating system that runs on the Intel® Itanium® architecture.

The following typographic conventions may be used in this manual:

Conventions Meaning
<> A diamond in the printed manual, or angle brackets (<>) in the online HTML manual, signals the end of a section of system-specific information. The beginning of a system-specific section is identified in the text or header as Alpha- or I64- or as VAX-specific.
.
.
.
A vertical ellipsis indicates the omission of items from a code example or command format; the items are omitted because they are not important to the topic being discussed. Most program examples are shown in HP terminal format, rather than in ANSI standard format.
quotation mark The quotation mark is used to refer to the double quotation mark character (").
apostrophe The apostrophe is used to refer to the single quotation mark character (').
user input In examples in printed versions of this document, user input (what you enter) is shown as monospaced text. In examples in online versions of this document, user input (what you enter) is shown as monospaced bold text.
bold type Bold type represents the introduction of a new term. It also represents the name of an argument, an attribute, or a reason.
italic type Italic type indicates important information, complete titles of manuals, or variables. Variables include generic terms (lowercase variable elements in syntax) when referred to in text; and information that varies in system output (Internal error number), in command lines (/PRODUCER= name), and in command parameters in text (where dd represents the predefined code for the device type).
[Return] In examples, a key name enclosed in a box indicates that you press a key on the keyboard. (In text, a key name is not enclosed in a box.)
[CTRL/x] The symbol [CTRL/x] indicates that you hold down the key labeled CTRL while you simultaneously press another key; for example, [CTRL/C], [CTRL/O].
$ The dollar sign ($) represents the OpenVMS system prompt.

References

The following table shows certain references and their respective meanings in this manual:

Reference Meaning
Alpha OpenVMS Alpha or Tru64 UNIX operating system
OpenVMS OpenVMS Alpha or OpenVMS I64 or OpenVMS VAX operating system
Tru64 UNIX Tru64 UNIX operating system
DECset DECset for OpenVMS
CDD Oracle CDD/Repository

Tru64 UNIX was formerly known as Compaq Tru64 Unix, DEC OSF/1, or as DIGITAL UNIX. HP COBOL was formerly known as Compaq COBOL, DIGITAL COBOL, or DEC COBOL. HP COBOL for OpenVMS VAX was formerly known as Compaq COBOL for OpenVMS VAX, VAX COBOL, or as DIGITAL VAX COBOL.

Acknowledgment

COBOL is an industry language and is not the property of any company or group of companies, or of any organization or group of organizations.

No warranty, expressed or implied, is made by any contributor or by the CODASYL COBOL Committee as to the accuracy and functioning of the programming system and language. Moreover, no responsibility is assumed by any contributor, or by the committee, in connection therewith.

The authors and copyright holders of the copyrighted material used herein are as follows: FLOW-MATIC (trademark of Unisys Corporation), Programming for the UNIVAC (R) I and II, Data Automation Systems, copyrighted 1958, 1959, by Unisys Corporation; IBM Commercial Translator Form No. F28-8013, copyrighted 1959 by IBM; FACT, DSI 27A5260-2760, copyrighted 1960 by Minneapolis-Honeywell.

They have specifically authorized the use of this material, in whole or in part, in the COBOL specifications. Such authorization extends to the reproduction and use of COBOL specifications in programming manuals or similar publications.

Field Test Sites

We are indebted to our field test sites. The people at these sites provide us with invaluable information, which ultimately results in a higher quality product---an HP COBOL that does more of what programmers need to produce applications for today's data processing.


Chapter 1
Program Organization and Structure

The fundamental elements of the COBOL language are described in the current ANSI standard and the HP COBOL basic documentation set. The elements specific to database programming have been collected and concentrated in this optional book for the convenience of programmers who write COBOL database programs.

1.1 Program Structure

Figure 1-1 shows the basic structure of a COBOL program, which is organized in divisions, sections, paragraphs, sentences, and entries.

Figure 1-1 Structure of a COBOL Program



IDENTIFICATION DIVISION.
   PROGRAM-ID. program-name.
   AUTHOR.
   INSTALLATION.
   DATE-WRITTEN.
   DATE-COMPILED.
   SECURITY.

ENVIRONMENT DIVISION.
 CONFIGURATION SECTION.
   SOURCE-COMPUTER.
   OBJECT-COMPUTER.
   SPECIAL-NAMES.
 INPUT-OUTPUT SECTION.
   FILE-CONTROL.
   I-O-CONTROL.

DATA DIVISION.
 SUBSCHEMA SECTION.
   subschema entries and keeplist entries
 FILE SECTION.
   file and record description entries
   report file description entries
   sort-merge file and record description entries
 WORKING-STORAGE SECTION.
   record description entries
 LINKAGE SECTION.
   record description entries
 REPORT SECTION.
   report and report group description entries.
 SCREEN SECTION.  (Alpha, I64)
   screen description entries  (Alpha, I64)
PROCEDURE DIVISION.
 DECLARATIVES.
   sections
     paragraphs
       sentences
 END DECLARATIVES.
       .
       .
       .
   sections
     paragraphs
       sentences
       .
       .
       .
 END PROGRAM header

The Data Division can contain a special SUB-SCHEMA SECTION section header for the Oracle CODASYL DBMS program, as shown in Figure 1-1.

A Data Division entry begins with a level indicator or level-number and is followed, in order, by:

  1. A space
  2. The name of a data item or file connector
  3. A sequence of independent descriptive clauses
  4. A separator period

The COBOL level indicators are as follows:

  • DB (for subschema entries)
  • LD (for keeplist entries)
  • FD (for file description entries)
  • SD (for sort-merge file description entries)
  • RD (for report file description entries)

The first two level indicators in this list, DB and LD, are used in Oracle CODASYL DBMS database programs. FD, SD, and RD can be in database programs as well as in other programs.

Level indicators start in Area A.

Entries that begin with level-numbers are called data description entries. The level-number values are 01 to 49, 66, 77, and 88. Level-numbers 01 to 09 can be represented as one- or two-digit numbers.

Level 01 and 77 data description entries begin in Area A. All other data description entries can begin anywhere to the right of Margin A. Indentation has no effect on level-number magnitude; it merely enhances readability.


Previous Next Contents Index