[an error occurred while processing this directive]

HP OpenVMS Systems Documentation

Content starts here

HP COBOL
Reference Manual


Previous Contents Index

Related Documents

For additional information about HP OpenVMS products and services, visit the following World Wide Web address:


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

Conventions Used in This Document

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 table lists the conventions used in this manual:


References

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

Reference Meaning
Alpha OpenVMS Alpha or Tru64 UNIX Alpha operating system
OpenVMS OpenVMS Alpha, OpenVMS I64, or OpenVMS VAX operating system
Tru64 UNIX Tru64 UNIX Alpha operating system
VAX OpenVMS VAX operating system

Tru64 UNIX was formerly known as 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.

Acknowledgement

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.

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

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


Chapter 1
Overview of the COBOL Language

This chapter provides information about the structure and language of COBOL source programs. It describes the elements of the COBOL language, reference formats, and language organization.

The COBOL language consists of the following components:

  • Programs
  • Divisions
  • Sections
  • Paragraphs
  • Sentences
  • Statements
  • Clauses
  • Entries
  • Words
  • Characters

A separately compiled COBOL program is a program that, together with its contained programs (if present), is compiled separately from all other programs. Each COBOL program is divided into four parts, called divisions: the Identification Division, Environment Division, Data Division, and Procedure Division. Divisions can contain sections, which in turn can contain paragraphs. Paragraphs can contain sentences, clauses, statements, or entries.

The building blocks of these language components include the COBOL character set, character-strings, separators, punctuation, and literals.

A COBOL program is a string of characters that is syntactically correct according to the COBOL language rules.

1.1 The COBOL Character Set

The COBOL character set, shown in Table 1-1, is used to form character-strings and separators.

The only components of a COBOL program that can contain characters outside this set are nonnumeric literals, comment-entries, and comment lines. Appendix B specifies the more inclusive computer character sets these elements can use.

Table 1-1 The COBOL Character Set
Character Meaning
0, 1, ..., 9 digit
A, B, ..., Z letter
a, b, ..., z lowercase letter (equivalent to letter)
+ plus sign
- minus sign (hyphen)
* asterisk
/ slash (stroke, virgule)
\ backslash
= equal sign
$ currency sign
> greater than symbol
< less than symbol
: colon
_ underline (underscore)
  space
[Tab] horizontal tab
( left parenthesis
) right parenthesis
, comma (decimal point)
; semicolon
. period (decimal point, full stop)
" quotation mark (double quotation mark)
' apostrophe (single quotation mark)
{ left brace
} right brace
[ left bracket
] right bracket
« double left-angle brackets
» double right-angle brackets

Except in nonnumeric literals, the compiler treats lowercase letters as if they were uppercase. Therefore, a program can contain COBOL words without regard to case.1 For example, the compiler recognizes the COBOL words in each of the following pairs as identical:


WORKING-STORAGE      Working-Storage
Input                input
file-a               FILE-A
INSPECT              InSpect

Note

1 On Tru64 UNIX the case sensitivity of the system affects COBOL's case insensitivity in a few situations. See the Section 3.1.1 paragraph in Chapter 3, and the section on Section 6.8.4 in Chapter 6. Also refer to the HP COBOL User Manual for a description of the -names lowercase, -names uppercase, and -names as_is flags.


Previous Next Contents Index