IBM extensions and COBOL standards
IBM® extensions are features, syntax rules, or behaviors defined by IBM rather than by the COBOL standards. IBM extensions generally add features, syntax, or rules that are not specified in the ANSI and ISO COBOL standards that are listed in Industry specifications. The term 85 COBOL Standard refers to those standards.
IBM extensions
The COBOL standards are listed in Industry specifications.
Table 1 lists IBM extensions with a brief description. Standard behavior is shown in brackets, [ ], when the standard behavior is not obvious. Extensions are described in more detail throughout this document, but they are not further identified as extensions.
Many IBM extensions are distinguished from standard language by their syntax. For others, you use compiler options to choose between standard and extension behavior. Generally, the related compiler options are noted in the detailed rules. For information about compiler options, see Option settings for 85 COBOL Standard conformance in the Enterprise COBOL Programming Guide.
If an item is listed as an extension, all related rules are also extensions. For example, USAGE DISPLAY-1 for DBCS characters is listed as an extension; its many uses in statements and clauses are also extensions, but are not listed separately.
Language area | Extension elements |
---|---|
COBOL words | User-defined words written in DBCS
characters Computer-name written in DBCS characters Class-names (for object orientation) Method-names User-defined words can include an underscore, but not as the first character. |
National character support (Unicode support) | Support for UTF-16 with USAGE NATIONAL Allowance of UTF-8 with USAGE DISPLAY Usage NATIONAL for data categories national, national-edited, numeric, numeric-edited, external decimal, and external floating-point GROUP-USAGE clause with the NATIONAL phrase National literals (basic and hexadecimal) National character value for figurative constants SPACE, ZERO, QUOTE, HIGH-VALUES, LOW-VALUES, ALL literal Intrinsic functions for data conversion: Extended case mapping with UPPER-CASE and LOWER-CASE functions |
Implicit items | Special object references:
Special registers:
|
Figurative constants | Selection of apostrophe (' ) as the value of the figurative
constant QUOTE NULL and NULLS for pointers and object references |
Literals | Use of apostrophe (' ) as an alternative to the quotation mark
(" ) in opening and closing delimiters Mixed single-byte and double-byte characters in alphanumeric literals (mixed literals) Hexadecimal
notation for alphanumeric literals, defined by opening delimiters Null-terminated alphanumeric literals, defined by opening delimiters DBCS
literals, defined by opening delimiters Consecutive alphanumeric literals (coding two consecutive alphanumeric literals by ending the first literal in column 72 of a continued line and starting the next literal with a quotation mark in the continuation line) National
literals
19- to 31-digit fixed-point numeric literals. [The 85 COBOL Standard specifies a maximum of 18 digits.] Floating-point numeric literals |
Comments | Comment lines before the IDENTIFICATION DIVISION header Comment lines and comment entries containing multibyte characters |
End markers | The following end markers:
|
Indexing and subscripting | Referencing a table with an index-name defined for a different table
Specifying a positive signed integer literal following the operator + or - in relative subscripting |
IDENTIFICATION DIVISION for programs | Abbreviation ID for IDENTIFICATION
An optional separator period following PROGRAM-ID, AUTHOR, INSTALLATION, DATE-WRITTEN, and SECURITY paragraph headers. [The 85 COBOL Standard requires a period following each of these paragraph headers.] An optional separator period following program-name in the PROGRAM-ID paragraph. [The 85 COBOL Standard requires a period following program-name.] An alphanumeric literal for program-name in the PROGRAM-ID paragraph; characters $, #, and @ in the name of the outermost program, and the underscore can be the first character; program-name up to 160 characters in length. [The 85 COBOL Standard requires that program-name be specified as a user-defined word.] |
End markers | Program-name in a literal. [The 85 COBOL Standard requires that program-name be specified as a user-defined word.] |
Object-oriented structure | In a class definition:
In a method definition: |
Configuration section | Repository paragraph |
SPECIAL-NAMES paragraph | The optional order of clauses. [The 85 COBOL Standard
requires that the clauses be coded in the order presented in the syntax diagram.] Optionality of a period after the last clause when no clauses are coded. [The 85 COBOL Standard requires a period, even when no clauses are coded.] Multiple CURRENCY SIGN clauses. [The 85 COBOL Standard allows a single CURRENCY SIGN clause.] WITH PICTURE SYMBOL phrase in the CURRENCY SIGN clause Multiple-character and mixed-case currency signs in the CURRENCY SIGN clause (when the WITH PICTURE SYMBOL phrase is specified). [The 85 COBOL Standard allows only one character, and it is both the currency sign and the currency picture symbol. The standard currency sign must not be:
Use of lower-case alphabetic characters as a currency sign. [The 85 COBOL Standard allows only uppercase characters.] |
INPUT-OUTPUT SECTION, FILE-CONTROL paragraph | Optionality of "FILE-CONTROL." when the INPUT-OUTPUT SECTION is specified, no
file-control-paragraph is specified, and there are no files defined in the compilation unit. [The
85 COBOL Standard requires that "FILE-CONTROL." be coded if "INPUT-OUTPUT
SECTION." is coded.] Optionality of the file-control-paragraph when the "FILE CONTROL." syntax is specified and there are no files defined in the compilation unit. [The 85 COBOL Standard requires that a file-control-paragraph be coded if "INPUT-OUTPUT SECTION." is coded.] The second data-name in the FILE STATUS clause Optionality of RECORD in the ALTERNATE RECORD KEY clause. [The 85 COBOL Standard requires the word RECORD.] A numeric, numeric-edited, alphanumeric-edited, alphabetic, internal floating-point, external floating-point, national, national-edited, or DBCS primary or alternate record key data item. [The 85 COBOL Standard requires that the key be alphanumeric.] A primary or alternate record key defined outside the minimum record size for indexed files containing variable-length records. [The 85 COBOL Standard requires that the primary and alternate record keys be within the minimum record size.] A numeric data item of usage DISPLAY or NATIONAL in the FILE STATUS clause. [The 85 COBOL Standard requires an alphanumeric file status data item.] The ORGANIZATION IS LINE SEQUENTIAL clause and line-sequential file control format National literal in the PADDING CHARACTER clause |
INPUT-OUTPUT SECTION, I-O-CONTROL paragraph | APPLY WRITE-ONLY clause
Specifying only one file-name in the SAME clause in the sequential, indexed, and sort-merge formats of the I-O-control entry. [The 85 COBOL Standard requires at least two file-names.] Optionality of the keyword ON in the RERUN clause. [The 85 COBOL Standard requires that ON be coded.] The line-sequential format I-O-control entry The RERUN clause in the sort-merge I-O-control entry |
DATA DIVISION | LOCAL-STORAGE SECTION The GLOBAL clause in the LINKAGE SECTION Specifying level numbers that are lower than other level numbers at the same hierarchical level in a data description entry. [The 85 COBOL Standard requires that all elementary or group items at the same level in the hierarchy be assigned identical level numbers.] Data categories internal floating-point, external floating-point, DBCS, national, and national-edited. Data category numeric with usage NATIONAL. Data category numeric-edited with usage NATIONAL. |
FILE SECTION | data-name in the LABEL RECORDS clause, for specifying user labels
Line-sequential format file description entry |
Sort/merge file description entry | The following clauses: |
BLOCK CONTAINS clause | BLOCK CONTAINS 0 for QSAM files. [The 85 COBOL Standard requires that at least 1 CHARACTER or RECORD be specified in the BLOCK CONTAINS clause.] |
VALUE OF clause | The lack of VALUE clause effect on execution when specified under an SD |
DATA RECORDS clause | Optionality of an 01 record description entry for a specified data-name. [The 85 COBOL Standard requires that an 01 record with the same data-name be specified.] |
LINAGE clause | Specifying LINAGE for files opened in EXTEND mode |
BLANK WHEN ZERO clause | Alternative spellings ZEROS and ZEROES for ZERO |
GLOBAL clause | Specifying GLOBAL in the LINKAGE SECTION |
INDEXED BY phrase | Nonunique unreferenced index names |
OCCURS clause | Omission of "integer-1 TO" for variable-length tables
Complex OCCURS DEPENDING ON. [The 85 COBOL Standard requires that an entry containing OCCURS DEPENDING ON be followed only by subordinate entries, and that no entry containing OCCURS DEPENDING ON be subordinate to an entry containing OCCURS DEPENDING ON.] Implicit qualification of a key specified without qualifiers when the key name is not unique Reference to a table through indexing when no INDEXED BY phrase is specified Keys of usages COMPUTATIONAL-1, COMPUTATIONAL-2, COMPUTATIONAL-3, COMPUTATIONAL-4, and COMPUTATIONAL-5 in the ASCENDING/DESCENDING KEY phrase Acceptance of nonunique index-names that are not referenced |
PICTURE clause | A picture character-string containing 31 to 50 characters. [The 85 COBOL Standard allows a maximum of 30 characters.] Picture symbols G and N Picture symbol E and the external floating-point picture format Coding a trailing comma insertion character or trailing period insertion character immediately followed by a separator comma or separator semicolon in a PICTURE clause that is not the last clause of a data description entry. [The 85 COBOL Standard requires that a PICTURE clause containing a picture ending with a comma or period be the last clause in the entry and that it be followed immediately by a separator period.] Selecting a currency sign and currency symbol with the CURRENCY compiler option Case-sensitive currency symbols The maximum of 31 digits for numeric items of usages DISPLAY and PACKED-DECIMAL and for numeric-edited items of USAGE DISPLAY The effect of the TRUNC compiler option on the value of data items described with a usage of BINARY, COMPUTATIONAL, or COMPUTATIONAL-4 |
REDEFINES clause | Specifying REDEFINES of a redefined data item At a subordinate level, specifying a redefining data item that has a size greater than the size of the redefined data item |
SYNCHRONIZED clause | Specifying SYNCHRONIZED for a level 01 entry |
USAGE clause | The following phrases:
Use of the SYNCHRONIZED clause for items of usage INDEX |
VALUE clause for condition-name entries | A VALUE clause in file and LINKAGE SECTION other than in condition-name entries
A VALUE clause for a condition-name entry on a group that has usages other than DISPLAY VALUE IS NULL and VALUE IS NULLS |
VOLATILE clause | A VOLATILE clause in a format 1 data description entry |
PROCEDURE DIVISION | Omission of a section-name Omission of a paragraph-name when a section-name is omitted A method, factory, or object procedure division Referencing data items in the LINKAGE SECTION without a USING phrase in the PROCEDURE DIVISION header (when those data-names are the operand of an ADDRESS OF phrase or ADDRESS OF special register) The following statements: |
PROCEDURE DIVISION header | The BY VALUE phrase
Specifying a data item in the USING phrase when the data item has a REDEFINES clause in its description Specifying multiple instances of a given data item in the USING phrase |
Declarative Procedures | Performing a nondeclarative procedure from a declarative procedure Referencing a declarative procedure or nondeclarative procedure in a GO TO statement from a declarative procedure. [The 85 COBOL Standard specifies that a declarative procedure must not reference a nondeclarative procedure. A reference to a declarative procedure from either another declarative procedure or a nondeclarative procedure is allowed only with a PERFORM statement.] Executing an active declarative |
Procedures | Specifying priority-number as a positive signed numeric
literal. [The 85 COBOL Standard requires an unsigned integer.] Omitting the section-header after the declaratives or when there are no declaratives. [The 85 COBOL Standard requires a section-header following the "DECLARATIVES." syntax and following the "END DECLARATIVES." syntax.] Omitting an initial paragraph-name if there are no declaratives. [The 85 COBOL Standard requires a paragraph-name in the following circumstances:
and the 85 COBOL Standard requires that procedural statements be within a paragraph.] Specifying paragraphs that are not contained within a section, even if some paragraphs are so contained. [The 85 COBOL Standard requires that paragraphs be within a section except when there are no declaratives. The 85 COBOL Standard requires that either all paragraphs be in sections or that none be.] |
Conditional expressions | DBCS and KANJI class conditions Specifying data items of usage COMPUTATIONAL-3 or usage PACKED-DECIMAL in a NUMERIC class test |
Relation condition | Enclosing an alphanumeric, DBCS, or national literal in parentheses The data-pointer format, the procedure-pointer and function-pointer format, and the object-reference format Comparison of an index-name with an arithmetic expression Use of parentheses within abbreviated combined relation conditions Note: Enterprise COBOL supports most parenthesis usage as IBM extensions with the following exceptions:
|
CORRESPONDING phrase | Specifying an identifier that is subordinate to a filler item |
INVALID KEY phrase | Omission of both the INVALID KEY phrase and an applicable EXCEPTION/ERROR procedure. [The 85 COBOL Standard requires at least one of them.] |
ACCEPT statement | The environment-name operand of the FROM phrase The DATE YYYYMMDD phrase The DAY YYYYDDD phrase |
ADD statement | A composite of operands greater than 18 digits |
ALLOCATE statement | The LOC phrase |
CALL statement | The procedure-pointer and function-pointer operands for identifying the program
to be called The following phrases and parameters:
Specifying a file-name as an argument Specifying the called program-name in an alphabetic or zoned-decimal data item Specifying an argument defined as a subordinate group item. [The 85 COBOL Standard requires that arguments be an elementary data item or a group item defined with level 01.] |
CANCEL statement | Specifying the name of the program to be canceled in an alphabetic or
zoned-decimal data item The effect of the PGMNAME compiler option on the name of the program to be canceled |
CLOSE statement | WITH NO REWIND phrase The line-sequential format |
COMPUTE statement | The use of the word EQUAL in place of the equal sign (=) |
DISPLAY statement | The environment-name operand of the UPON phrase Displaying signed numeric literals and noninteger numeric literals |
DIVIDE statement | A composite of operands greater than 18 digits |
EXIT statement | Specifying the EXIT statement in a sentence that has statements before or after the EXIT statement or in a paragraph that has other sentences. [The 85 COBOL Standard requires that the EXIT statement be specified in a sentence by itself and that the sentence be the only sentence in the paragraph.] |
EXIT PROGRAM statement | Specifying EXIT PROGRAM before the last statement in a sequence of imperative statements. [The 85 COBOL Standard requires that the EXIT PROGRAM statement be specified as the last statement in a sequence of imperative statements.] |
GO TO statement | Coding the unconditional format before the last statement in a sequence of
imperative statements. [The 85 COBOL Standard requires that an
unconditional GO TO be coded:
|
IF statement | The use of END-IF with the NEXT SENTENCE phrase. [The 85 COBOL Standard disallows use of END-IF with NEXT SENTENCE.] |
INITIALIZE statement | DBCS, EGCS, NATIONAL, and NATIONAL-EDITED in the REPLACING
phrase
Initializing a data item that contains the DEPENDING phrase of the OCCURS clause |
MERGE statement | Specifying file-names in a SAME clause |
MULTIPLY statement | A composite of operands greater than 18 digits |
OPEN statement | The line-sequential format Specifying the EXTEND phrase for files that have a LINAGE clause |
PERFORM statement | An empty in-line PERFORM statement A common exit for two or more active PERFORMS |
READ statement | Omission of both the AT END phrase and an
applicable declarative procedure Omission of both the INVALID KEY phrase and an applicable declarative procedure Read into an item that is neither an alphanumeric group item nor an elementary alphanumeric item |
RETURN statement | Return into an item that is neither an alphanumeric group item nor an elementary alphanumeric item |
REWRITE statement | Omission of both the INVALID KEY phrase and an applicable declarative procedure
Rewriting a record with a different number of character positions than the number of character positions in the record being rewritten |
SEARCH statement | Specifying END SEARCH with NEXT SENTENCE Omission of both the NEXT SENTENCE phrase and imperative statements in the binary search format |
SET statement | The data-pointer format The procedure-pointer and function-pointer format The object reference format |
SORT statement | Specifying GIVING file-names in the SAME clause |
START statement | Omission of both the INVALID KEY phrase and an applicable exception procedure
Use of a key of a category other than alphanumeric |
STOP statement | Specifying a noninteger fixed-point literal or a signed numeric integer or
noninteger fixed-point literal Coding STOP as other than the last statement in a sentence |
STRING statement | Reference modification of the data item specified in the INTO phrase |
SUBTRACT statement | A composite of operands greater than 18 digits |
UNSTRING statement | Reference modification of the sending field |
WRITE statement | INVALID KEY and NOT ON INVALID KEY phrases The line-sequential format For a relative file, writing a different number of character positions than the number of character positions in the record being replaced Specifying both the ADVANCING PAGE and END-OF-PAGE phrases in a single WRITE statement The effect of the ADV compiler option on the length of the record written to a file Using WRITE ADVANCING with stacker selection for a card punch file For a relative or indexed file, omission of both the INVALID KEY phrase and an applicable exception procedure |
Intrinsic functions | The effect of the INTDATE
compiler options on the INTEGER-OF-DATE and INTEGER-OF-DAY functions The following functions: |
FACTORIAL function | The effect of the ARITH(EXTEND) compiler option on the range of values permitted in the argument |
LENGTH function | Specifying a pointer, the ADDRESS OF special register, or the LENGTH OF special register as an argument to the function |
NUMVAL function | The effect of the ARITH(EXTEND) compiler option on the maximum number of digits allowed in the argument |
NUMVAL-C function | The effect of the ARITH(EXTEND) compiler option on the maximum number of digits allowed in the argument |
NUMVAL-F function | The effect of the ARITH(EXTEND) compiler option on the maximum number of digits allowed in the argument |
TEST-NUMVAL function | The effect of the ARITH(EXTEND) compiler option on the maximum number of digits allowed in the argument |
TEST-NUMVAL-C function | The effect of the ARITH(EXTEND) compiler option on the maximum number of digits allowed in the argument |
TEST-NUMVAL-F function | The effect of the ARITH(EXTEND) compiler option on the maximum number of digits allowed in the argument |
Compiler-directing statements | The following statements: |
Compiler directives | CALLINTERFACE directive |
COPY statement | The optionality of the syntax "OF library-name" for
specifying a text-name qualifier Literals for specifying text-name and library-name SUPPRESS phrase Nested COPY statements Hyphen as the first or last character in the word form of REPLACING operands The use of any character (other than a COBOL separator) in the word form of REPLACING operands. [The 85 COBOL Standard accepts only the characters used in formation of user-defined words.] |
COBOL standards
Extensions range from minor relaxation of rules to major capabilities, such as XML support, Unicode support, object-oriented COBOL for Java interoperability, and DBCS character handling.