1 – literals
A literal is a character-string whose value is specified by: 1) the ordered set of characters it contains, or 2) a reserved word that is a figurative constant. Every literal belongs to one of two types: numeric or nonnumeric.
1.1 – figurative_constants
Figurative constants name and refer to specific constant values generated by the compiler. The singular and plural forms of figurative constants are equivalent and interchangeable. The figurative constants supported by VSI COBOL are ZERO, ZEROS, ZEROES, SPACE, SPACES, HIGH-VALUE, HIGH-VALUES, LOW-VALUE, LOW-VALUES, QUOTE, QUOTES, ALL literal, and symbolic-character.
1.2 – hexadecimal_literals
A hexadecimal literal (a HP extension to nonnumeric literals) is a character string of 2 to 256 hexadecimal digits. It is delimited on the left by the separator 'X' (or 'x') immediately followed by a quotation mark (") or apostrophe ('); on the right it is delimited by a matching quotation mark or apostrophe. The character string consists only of pairs of hexadecimal digits representing a value ranging from 00 to FF; hence, only the characters '0' through '9', 'A' through 'F', and 'a' through 'f' are valid. The value of a hexadecimal literal is the composite value of the paired hexadecimal representations. The compiler truncates hexadecimal literals to a maximum of 128 hexadecimal representations (pairs of hexadecimal digits). A hexadecimal literal can be used interchangeably wherever a nonnumeric literal can appear in VSI COBOL syntax. (Note that hexadecimal literals cannot be used as operands in arithmetic statements.)
1.3 – nonnumeric_literals
A nonnumeric literal is a character-string of 0 to 256 characters. It is delimited on both ends by quotation marks (") or apostrophes ('). A nonnumeric literal delimited by apostrophes is treated in the same manner as a nonnumeric literal delimited by quotation marks. The value of a nonnumeric literal is the value of the characters in the character-string. It does not include the quotation marks (or apostrophes) that delimit the character-string. All other punctuation characters in the nonnumeric literal are part of its value. The compiler truncates nonnumeric literals to a maximum of 256 characters.
1.4 – numeric_literals
A numeric literal is a character-string of 1 to 33 characters selected from the digits 0 through 9, the plus sign, the minus sign, and the decimal point. The value of a numeric literal is the algebraic quantity represented by the characters in the literal. Its size equals the number of digits in the character-string.
1.5 – floating_point_literals
A floating point literal is a character-string whose value is specified by 4 to 37 characters selected from the digits 0 to 9, the plus sign, the minus sign, the decimal point and the letter E (upper or lower case). The value of a floating point literal is the algebraic quantity represented by the characters in the literal that precede the "E" multiplied by ten raised to the power of the algebraic quantity represented by the characters in the literal following the "E".
2 – meta-language
The COBOL meta-language describes COBOL syntax. Meta-language elements appear in formats, but they are not part of a source program.
2.1 – braces
Braces ({}) indicate that you must select one (but no more than one) of the enclosed entries. If one of the entries contains only reserved words that are not key words, that entry is the default option when no other entry is selected.
2.2 – brackets
Brackets ([]) enclose an optional part of a general format. When they enclose vertically stacked entries, brackets indicate that you can select one (but no more than one) of the enclosed entries.
2.3 – choice_indicators
If choice indicators, {| |}, enclose part of a general format, you must select one or more of the enclosed entries (in any order). However, no entry can be used more than once.
2.4 – ellipsis
In general formats, the ellipsis (...) allows repetition of a part of the format. To determine which part of the format can be repeated: 1) Find the ellipsis. 2) Scanning to the left, find the first right delimiter, either ] or }. 3) Continuing to the left, find its logically matching left delimiter, either [ or {. The ellipsis applies to the part of the format between the matched pair of delimiters.
2.5 – lowercase_words
Lowercase words are generic terms. They indicate entries the programmer must provide. Lowercase words can represent COBOL words, literals, PICTURE character-strings, comment-entries, function arguments, or complete syntactical entries.
2.6 – special-character_words
The following special-character words are not underlined in general formats but are required where they appear: colon (:) single (=) and double (==) equal signs period (.) left (() or right ()) parenthesis plus sign (+) left (<) or right (>) angle bracket minus sign (-) single (*) and double (**) asterisk slash (/)
2.7 – uppercase_words
Underlined uppercase words are key words. A key word is required and must be spelled correctly when it is included in the source program. Uppercase words not underlined are optional. They serve only to improve the source program's readability.
3 – program_components
A COBOL program is made up of a number of different components. These are listed alphabetically.
3.1 – clause
A subdivision of a COBOL sentence; an ordered set of consecutive COBOL character-strings that specifies an attribute of an entry.
3.2 – contained_program
A COBOL source program that is directly or indirectly contained in another COBOL source program.
3.3 – division
A division is a collection of one or more sections or paragraphs. Each of the four divisions consists of a division header and division body. A division header identifies and marks the beginning of a division. It is a specific combination of reserved words followed by a separator period.
3.4 – end_of_program
The end of a COBOL source program is indicated either by the end of that program's Procedure Division or by the END PROGRAM header. Format - END PROGRAM program-name program-name must contain 1 to 31 characters and follow the rules for user-defined words. It must be identical to a program-name declared in a preceding PROGRAM-ID paragraph.
3.5 – paragraph
A paragraph consists of a paragraph header or paragraph-name (depending on the division) followed by zero, one, or more entries (or sentences). A paragraph header is a reserved word followed by a separator period. Paragraph headers identify paragraphs in the Identification and Environment Divisions. A paragraph-name is a user-defined word followed by a separator period. Paragraph-names identify Procedure Division paragraphs.
3.6 – phrase
An ordered set of one or more consecutive COBOL character-strings that forms part of a clause or procedural statement.
3.7 – program_organization
identification-division [ environment-division ] [ data-division ] [ procedure-division ] [ source-program ] ... [ end-program-header ]
3.8 – section
A section is a set of zero, one, or more paragraphs or entries (called a section body) that follows a section header and related section body. A section header identifies and marks the beginning of a section in the Environment, Data, and Procedure Divisions. In the Environment and Data Divisions, a section header is a specific combination of reserved words followed by a separator period. In the Procedure Division, a section header is a user-defined word followed by the word SECTION (and an optional segment-number). A separator period always follows a section header.
3.9 – sentence
A sequence of one or more statements, the last of which ends with a separator period.
3.10 – separators
A separator delimits character-strings. It can be one character or two contiguous characters. The following characters are recognized as separators: space ( ) quotation mark (") comma (,) apostrophe (') semicolon (;) pseudo-text delimiter (==) period (.) horizontal tab colon (:) left (() or right ()) parenthesis
3.11 – source-program
represents a contained (nested) COBOL source program. It begins with the Identification Division, a COPY statement or a REPLACE statement. It ends with the END PROGRAM header or the end of the Procedure Division.
3.12 – statement
In the Procedure Division, a syntactically valid combination of words and symbols that begins with a verb.
3.13 – word
A character-string of not more than 31 characters that forms one of the following: function-name A COBOL word that names a mechanism provided to determine the value of a function. reserved word A COBOL word specified in the list of words that can appear in a COBOL program. A reserved word cannot appear in a program as a user-defined word or system-name. system-name A COBOL word that has already been defined by the implementor to refer to the program's operating environment. text-word A character (or a sequence of characters) in a COBOL library, source program, pseudo-text, or dictionary that is subject to certain restrictions. user-defined word A COBOL word that must appear in the source program to satisfy the format of a clause or statement. verb A word that causes the compiler or object program to take action.
4 – source_reference_format
The VSI COBOL compiler recognizes two source program formats: ANSI and terminal.
4.1 – ANSI format
ANSI format conforms to the American National Standard COBOL reference format. It describes COBOL programs in terms of character positions on an input line. A source program line has 80 character positions: Margin L C A B R | | | | | +--------------------------------------------------+ column | 1 - 6 | 7 | 8 - 11 | 12 - 72 | 73 - 80 | +--------------------------------------------------+ | | | | | | | Area A Area B Identification Area | | | Indicator Area | Sequence Number Area The compiler expects ANSI format only when the command line includes the /ANSI_FORMAT qualifier.
4.2 – terminal_format
The VSI COBOL terminal format shortens program preparation time and reduces storage space for source programs. There is no sequence number or identification area, and the indicator area is combined with Area A.
5 – special_registers
Compiler-generated storage areas primarily used to store information relating to specific COBOL features. There are four types: (1) Report Writer, (2) Record Management, (3) Database Management, and (4) X/Open related.
5.1 – 1 DB-CONDITION
A database special register whose value indicates either a successful condition or an exception condition.
5.2 – 2 DB-CURRENT-RECORD-ID
A database special register containing the subschema user ID number (UID) of the record type of the current record of the run unit. It contains zero if there is no current record of the run unit.
5.3 – 3 DB-CURRENT-RECORD-NAME
A database special register containing the name of the record type of the current record of the run unit. It contains spaces if there is no current record of the run unit.
5.4 – 4 DB-KEY
A database special register that holds the dbkey of the record accessed by the last FETCH, STORE or FIND statement. This special register can be used to fine tune storage strategies in the database.
5.5 – 5 DB-UWA
A database special register containing the user work area (UWA). The UWA is the record delivery area that is used by the DBCS to make data items available to your program.
5.6 – 6 LINAGE-COUNTER
A special register whose value points to the current position in the page body.
5.7 – 7 LINE-COUNTER
A Report Writer special register whose value points to the current line in the current page.
5.8 – 8 PAGE-COUNTER
A Report Writer special register whose value points to the current page in a report.
5.9 – 9 RMS-CURRENT-FILENAME
A Record Management Services (RMS) exception condition register containing the name of the file causing the exception condition. This register is implicitly associated with the file most recently operated on by an I/O statement.
5.10 – 10 RMS-CURRENT-STS
A Record Management Services (RMS) exception condition register. It contains the primary RMS status value of an I-O operation. This register is implicitly associated with the file most recently operated on by an I/O statement. RMS-CURRENT-STV is the secondary value.
5.11 – 11 RMS-CURRENT-STV
A Record Management Services (RMS) exception condition register. It contains the secondary RMS status value of an I-O operation. This register is implicitly associated with the file most recently operated on by an I/O statement. RMS-CURRENT-STS is the primary value.
5.12 – 12 RMS-FILENAME
A Record Management Services (RMS) exception condition register containing the name of the file causing the exception condition. At any point in time, this register must be explicitly associated with a particular file.
5.13 – 13 RMS-STS
A Record Management Services (RMS) exception condition register. It contains the primary RMS status value of an I-O operation. At any point in time, this register must be explicitly associated with a particular file. RMS-STV is the secondary value.
5.14 – 14 RMS-STV
A Record Management Services (RMS) exception condition register. It contains the secondary RMS status value of an I-O operation. At any point in time, this register must be explicitly associated with a particular file. RMS-STS is the primary value.
5.15 – 15 RETURN-CODE
A special register that may be used to set a return value for a calling program or to retreive the value returned from a called program.