| United States-English |
|
|
|
![]() |
HP OpenVMS Systems Documentation |
Compaq COBOLReference ManualOrder Number: AA--Q2G0G--TK
November 2002
This manual provides reference information and syntax for the Compaq COBOL programming language on its three platforms: OpenVMS Alpha, OpenVMS VAX, and Tru64 UNIX Alpha. Revision/Update Information: This manual supersedes the Compaq COBOL Reference Manual, Version 2.7 and the VAX COBOL Reference Manual, Version 5.4, as well as the online-only Compaq COBOL Reference Manual, Version 2.7 and Version 5.7.
Operating System and Version:
Software Version:
© 2002 Compaq Information Technologies Group, L.P. COMPAQ, the Compaq logo, AlphaServer, OpenVMS, POLYCENTER, Tru64, VAX, and VMS are trademarks of Compaq Information Technologies Group, L.P. in the U.S. and/or other countries. Motif, UNIX, and X/Open are trademarks of The Open Group in the U.S. and/or other countries. All other product names mentioned herein may be trademarks of their respective companies. Confidential computer software. Valid license from Compaq required for possession, use, or copying. Consistent with FAR 12.211 and 12.212, Commercial Computer Software, Computer Software Documentation, and Technical Data for Commercial Items are licensed to the U.S. Government under vendor's standard commercial license. None of Compaq, Hewlett-Packard Company ("HP") or any other direct or indirect subsidiary of HP shall be liable for technical or editorial errors or omissions contained herein. The information in this document is provided "as is" without warranty of any kind and is subject to change without notice. The warranties for Compaq or HP products are set forth in the express limited warranty statements accompanying such products. Nothing herein should be construed as constituting an additional warranty.
ZK6296 This manual is available on CD-ROM.
PrefaceThis book describes the constructs and rules of the Compaq COBOL programming language, which is a Compaq Computer Corporation implementation of COBOL (COmmon Business-Oriented Language) for the OpenVMS and Tru64 UNIX platforms. It includes information about language syntax and semantics, as well as information about adherence and extensions to various COBOL standards. This documentation set also includes the Compaq COBOL User Manual and, optionally, the Compaq COBOL DBMS Database Programming Manual. Compaq COBOL is the new name for DEC COBOL, for DIGITAL COBOL, and for VAX COBOL. Compaq COBOL, unmodified, refers to three products: Compaq COBOL for OpenVMS Alpha Any references to the former names in product documentation or other components should be construed as references to the Compaq COBOL names. Intended AudienceThis manual is intended for experienced applications programmers who have a thorough understanding of the COBOL language and some familiarity with their operating system. This is not a tutorial manual. If you are a new COBOL user, you may need to read introductory COBOL textbooks or take COBOL courses. Structure of This DocumentThis manual is organized as follows:
Associated DocumentsThe following documents contain additional information directly related to various topics covered in this manual: This manual describes how to use features of the Compaq COBOL language to develop programs on the Tru64 UNIX operating system or the OpenVMS operating systems on Alpha and VAX. Consult the Compaq COBOL release notes for your installed version for late corrections and new features. On the OpenVMS Alpha or VAX operating system, the release notes are in: SYS$HELP:COBOLnnn.RELEASE_NOTES (ASCII text) Where nnn is the version and release number. On the Tru64 UNIX operating system, the release notes are in: /usr/lib/cmplrs/cobol/relnotes
Compaq COBOL for Tru64 UNIX Systems Installation Guide
This manual provides instructions for installing Compaq COBOL on the Tru64 UNIX operating system.
Compaq COBOL for OpenVMS Alpha Systems Installation Guide
This manual provides instructions for installing Compaq COBOL on the OpenVMS Alpha operating system.
Compaq COBOL for OpenVMS VAX Systems Installation Guide
This manual provides instructions for installing Compaq COBOL on the OpenVMS VAX operating system.
Compaq COBOL DBMS Database Programming Manual
This manual provides information on using Compaq COBOL for database programming with Oracle CODASYL DBMS on the OpenVMS Alpha or OpenVMS VAX operating system.
The OpenVMS Calling Standard and other manuals in the OpenVMS Documentation Set
This set contains information about using the features of the OpenVMS Alpha and OpenVMS VAX operating systems and their tools.
The Tru64 UNIX Documentation Set
This set contains introductory and detailed information about using the features of the Tru64 UNIX operating system and its tools.
The Alpha Architecture Reference Manual
This manual is available from Digital Press.
Related DocumentsFor additional information about OpenVMS products and services, access the following World Wide Web address:
Conventions Used in This DocumentThe following table lists the conventions used in this manual:
ReferencesThe following table shows certain references and their respective meanings in this manual:
Tru64 UNIX was formerly known as DEC OSF/1 or as DIGITAL UNIX. Compaq COBOL was formerly known as DIGITAL COBOL or DEC COBOL. Compaq COBOL for OpenVMS VAX was formerly known as VAX COBOL or as DIGITAL VAX COBOL. AcknowledgementCOBOL 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 DocumentationVisit the following World Wide Web address for information about how to order additional documentation:
Reader's CommentsCompaq welcomes your comments on this manual. Please send comments to either of the following addresses:
Chapter 1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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 |
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 Compaq COBOL User Manual for a description of the -names lowercase, -names uppercase, and -names as_is flags. |
A character-string is a character or a sequence of
contiguous characters that form a COBOL word, a literal, a
PICTURE character-string, or a comment-entry. Separators delimit
character-strings. The following sections describe these topics in
detail.
1.2.1 COBOL Words
A COBOL word is a character-string of not more than 31 characters that forms one of the following:
A user-defined word or system-name cannot be a reserved word. However,
a program can use the same COBOL word as both a user-defined
word and a system-name. The compiler determines the word's class from
its context.
1.2.1.1 User-Defined Words
A user-defined word is a COBOL word that you must supply to satisfy the format of a clause or statement. This word consists of characters selected from the set A to Z, 0 to 9, the currency sign ($), underline (_), and hyphen (-). Throughout this manual, and except where specific rules apply, the hyphen (-) and the underline (_) are treated as the same character in a user-defined word. The underline (_), however, can begin or end a user-defined word, and the hyphen (-) cannot. By convention, names containing a currency sign ($) are reserved for Compaq.
Table 1-2 provides brief descriptions of the COBOL user-defined words.
| User-Defined Word | Purpose | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Alphabet-Name | Assigns a name to a character set, collating sequence, or both. Alphabet-names must be defined in the SPECIAL-NAMES paragraph. (See Section 4.1.3 in Chapter 4, Environment Division.) | ||||||||||||||||||
| Class-Name | Relates a name to a specified set of characters listed in that clause. (See Section 4.1.3 in Chapter 4, Environment Division.) | ||||||||||||||||||
| Condition-Name |
Assigns a name to a value, set of
values, or range of values in the complete set of values that a data
item can have. Data items with one or more associated condition-names
are called conditional variables.
Data Division entries define condition-names. Names assigned in the SPECIAL-NAMES paragraph to the "on" or "off" status of switches are also condition-names. |
||||||||||||||||||
| Data-Name | Names a data item described in a data description entry. When specified in a general format, data-name cannot be reference modified, subscripted, indexed, or qualified unless specifically allowed by the rules for that format. | ||||||||||||||||||
| File-Name |
Names a file connector. A
file connector
is a storage area that contains information
about a file and is the link between:
File description entries and sort-merge file description entries describe file connectors. |
||||||||||||||||||
| Index-Name | Names an index associated with a specific table. | ||||||||||||||||||
| Level-Number | Is a one- or two-digit number that describes a data item's special properties or its position in the structure of a record. (See Sections 5.1.1 and 5.1.2.) | ||||||||||||||||||
| Library-Name | Names a COBOL library used in a source program compilation. (See the Section 8.1.1 statement in Chapter 8.) | ||||||||||||||||||
| Mnemonic-Name | Associates a name with a system-name, such as CONSOLE, SYSERR, ARGUMENT-NUMBER, ENVIRONMENT-NAME, C01, OR SWITCH-8. (See Section 4.1.3 in Chapter 4.) | ||||||||||||||||||
| Paragraph-Name |
Names a Procedure Division
paragraph. (See Section 2.1.3.) Paragraph-names are equivalent only if
they are identical; that is, if they are composed of the same sequence
and number of digits and/or characters.
For example:
|
||||||||||||||||||
| Program-Name | Identifies a COBOL source program. (See the Section 3.1.1 paragraph in Chapter 3, and the section on Section 6.8.4 in Chapter 6, for a description of case-sensitivity on the Tru64 UNIX operating system. Also refer to the Compaq COBOL User Manual for a description of the -names lowercase , -names uppercase , and -names as_is flags.) | ||||||||||||||||||
| Record-Name | Names a data item described with level-number 01 or 77. | ||||||||||||||||||
| Report-Name | Names a report produced by the Report Writer Control System (RWCS). (See the Section 5.3.42 clause in Chapter 5.) | ||||||||||||||||||
| Screen-Name (Alpha) | Names a screen item defined in the SCREEN SECTION of a program. (See the Section 5.3.6 section of Chapter 5.)<> | ||||||||||||||||||
| Section-Name | Names a Procedure Division section. Section-names are equivalent only if they are identical; that is, when they are composed of the same sequence and number of digits and/or characters. (See Section 2.1.2.) | ||||||||||||||||||
| Segmented-Key-Name | Identifies a segmented key, which is a concatenation of one or more (up to eight) data items (segments) within a record associated with an indexed file. A segmented key is a form of primary or alternate key. It offers flexibility in defining record description entries for indexed files. (Refer to the section on segmented keys in the Compaq COBOL User Manual.) | ||||||||||||||||||
| Segment-Number | Is a 1- or 2-digit number that classifies a Procedure Division section for segmentation. In Compaq COBOL programs, segment-numbers specify independent and fixed segments. (See Section 6.7.) | ||||||||||||||||||
| Symbolic-Character | Identifies a user-defined figurative constant. | ||||||||||||||||||
| Text-Name | Identifies library text in a COBOL library. (See the Section 8.1.1 statement in Chapter 8.) |
Within a given program, but excluding any contained program, the user-defined words are grouped into the following disjoint sets:
alphabet-names
class-names
condition-names, data-names, and record-names
file-names
index-names
library-names
mnemonic-names
paragraph-names
program-names
report-names
screen-names
section-names
segmented-key-names
symbolic-characters
text-names
| Next | Contents | Index |
| ** About PDF files: The PDF files on this Web site can be read online or printed using Adobe® Acrobat® Reader. If you do not have this software installed on your system, you may download it from the Adobe Web site. | ||
|
|||||||||||||||