Rational Developer for System z
COBOL for Windows, Version 7.5, Language Reference


Appendix A. IBM extensions

IBM extensions are features, syntax rules, or behavior defined by IBM rather than by the COBOL standards listed in Appendix H. Industry specifications.

IBM extension language elements (Table 57) 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. You can find information about compiler options in the COBOL for Windows 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.

Table 57. IBM extension language elements
Language area Extension elements
COBOL words

User-defined words written in multibyte characters

System-names written in multibyte characters

Class-names (for object orientation)

Method-names

National character support (Unicode support)

Support for UTF-16 with USAGE NATIONAL

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:

  • DISPLAY-OF
  • NATIONAL-OF

Extended case mapping with UPPER-CASE and LOWER-CASE functions

Implicit items Special object references:
  • SELF
  • SUPER

Special registers:

  • ADDRESS OF
  • JNIENVPTR
  • LENGTH OF
  • RETURN-CODE
  • SHIFT-IN
  • SHIFT-OUT
  • SORT-CONTROL
  • SORT-CORE-SIZE
  • SORT-FILE-SIZE
  • SORT-MESSAGE
  • SORT-MODE-SIZE
  • SORT-RETURN
  • TALLY
  • WHEN-COMPILED
  • XML-CODE
  • XML-EVENT
  • XML-NTEXT
  • XML-TEXT
Figurative constants

Selection of apostrophe (') as the value of the figurative constant QUOTE

NULL/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 multibyte characters in alphanumeric literals (mixed literals)

Hexadecimal notation for alphanumeric literals, defined by opening delimiters X” and X'

Null-terminated alphanumeric literals, defined by opening delimiters Z“ and Z'

DBCS literals, defined by opening delimiters N”, N', G“, and G'. N” and N' are defined as DBCS when the NSYMBOL(DBCS) compiler option is in effect.

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 single quotation mark in the continuation line)

National literals N“, N', NX”, NX' for storing literal content as national characters. N“ and N' are defined as national when the NSYMBOL(NATIONAL) compiler option is in effect.

19- to 31-digit fixed-point numeric literals. [Standard COBOL 85 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:
  • END CLASS
  • END FACTORY
  • END METHOD
  • END OBJECT
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

Millennium language extensions and date fields.

DATE FORMAT clause

Windowed date fields, expanded date fields, year-last date fields, compatible date fields, date formats, and century window

The following intrinsic functions:

  • DATEVAL
  • UNDATE
  • YEARWINDOW
  • DATE-TO-YYYYMMDD
  • DAY-TO-YYYYDDD
  • YEAR-TO-YYYY
Identification division for programs

Abbreviation ID for IDENTIFICATION

RECURSIVE clause

An optional separator period following PROGRAM-ID, AUTHOR, INSTALLATION, DATE-WRITTEN, and SECURITY paragraph headers. [Standard COBOL 85 requires a period following each of these paragraph headers.]

An optional separator period following program-name in the PROGRAM-ID paragraph. [Standard COBOL 85 requires a period following program-name.]

An alphanumeric literal for program-name in the PROGRAM-ID paragraph; program-name up to 160 characters in length. [Standard COBOL 85 requires that program-name be specified as a user-defined word.]

End markers

Program-name in a literal. [Standard COBOL 85 requires that program-name be specified as a user-defined word.]

Object-oriented structure

In a class definition:

  • CLASS-ID paragraph
  • INHERITS clause
  • END CLASS marker

In a method definition:

  • METHOD-ID paragraph
  • EXIT METHOD statement
  • END METHOD marker
Configuration section Repository paragraph
SPECIAL-NAMES paragraph

The optional order of clauses. [Standard COBOL 85 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. [Standard COBOL 85 requires a period, even when no clauses are coded.]

Multiple CURRENCY SIGN clauses. [Standard COBOL 85 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). [Standard COBOL 85 allows only one character, and it is both the currency sign and the currency picture symbol. The standard currency sign must not be:

  • The same character as any standard picture symbol
  • A digit 0-9
  • One of the special characters * + - , ; ( ) ” = /
  • A space ]

Use of lower-case alphabetic characters as a currency sign. [Standard COBOL 85 allows only uppercase characters.]

Disallowance of the SYMBOLIC CHARACTERS clause, when a multibyte code page is indicated by the locale setting.

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. [Standard COBOL 85 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. [Standard COBOL 85 requires that a file-control-paragraph be coded if “INPUT-OUTPUT SECTION.” is coded.]

USING phrase of the ASSIGN clause

PASSWORD clause

The second data-name in the FILE STATUS clause

Optionality of RECORD in the ALTERNATE RECORD KEY clause. [Standard COBOL 85 requires the word RECORD.]

The lack of a RESERVE clause effect on execution

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. [Standard COBOL 85 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. [Standard COBOL 85 requires that the primary and alternate record keys be within the minimum record size.]

Sequential access to records in descending order. [Standard COBOL 85 provides only ascending order of access.]

A numeric data item of usage DISPLAY or NATIONAL in the FILE STATUS clause. [Standard COBOL 85 requires an alphanumeric file status data item.]

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. [Standard COBOL 85 requires at least two file-names.]

Optionality of the keyword ON in the RERUN clause. [Standard COBOL 85 requires that ON be coded.]

The line-sequential format I-O-control entry

The RERUN clause in the sort-merge I-O-control entry

Disallowance of the RERUN clause when using the THREAD compiler option

The lack of RERUN clause effect on execution when using the NOTHREAD compiler option

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. [Standard COBOL 85 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

RECORDING MODE clause

Line-sequential format file description entry

Sort/merge file description entry

The following clauses:

  • BLOCK CONTAINS
  • LABEL RECORDS
  • VALUE OF
  • LINAGE
  • CODE-SET
  • WITH FOOTING
  • LINES AT
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. [Standard COBOL 85 requires that an 01 record with the same data-name be specified.]
LINAGE clause Specifying LINAGE for files opened in EXTEND mode
Data Description Entry DATE-FORMAT clause
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. [Standard COBOL 85 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. [Standard COBOL 85 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. [Standard COBOL 85 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 and BINARY compiler options 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 phrases:

  • NATIVE
  • COMP-1 and COMPUTATIONAL-1
  • COMP-2 and COMPUTATIONAL-2
  • COMP-3 and COMPUTATIONAL-3
  • COMP-4 and COMPUTATIONAL-4
  • COMP-5 and COMPUTATIONAL-5
  • DISPLAY-1
  • OBJECT REFERENCE
  • NATIONAL
  • POINTER
  • PROCEDURE-POINTER
  • FUNCTION-POINTER

Use of the SYNCHRONIZED clause for items of usage INDEX

VALUE clause for condition-name entries

A VALUE clause in file and linkage sections in other than condition-name entries

A VALUE clause for a condition-name entry on a group that has usages other than DISPLAY

Specifying the range of values in a THROUGH phrase using a locale-defined collating sequence

VALUE IS NULL and VALUE IS NULLS

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 statements:

  • ENTRY
  • EXIT METHOD
  • GOBACK
  • INVOKE
  • XML PARSE
  • XML GENERATE
Procedure division header

The BY VALUE phrase

The RETURNING 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

The formats for method, factory, and object definitions

Declarative Procedures

The LABEL declarative

Executing an active declarative

Procedures

Specifying priority-number as a positive signed numeric literal. [Standard COBOL 85 requires an unsigned integer.]

Omitting the section-header after the declaratives or when there are no declaratives. [Standard COBOL 85 requires a section-header following the “DECLARATIVES.” syntax and following the “END DECLARATIVES.” syntax.]

Omitting an initial paragraph-name if there are no declaratives. [Standard COBOL 85 requires a paragraph-name in the following circumstances:

  • After the USE statement if there are statements in the declarative procedure
  • Following a section header outside declarative procedures
  • Before any procedural statement if there are no declaratives

and Standard COBOL 85 requires that procedural statements be within a paragraph.]

Specifying paragraphs that are not contained within a section, even if some paragraphs are so contained. [Standard COBOL 85 requires that paragraphs be within a section except when there are no declaratives. Standard COBOL 85 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

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. [Standard COBOL 85 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
CALL statement

The procedure-pointer and function-pointer operands for identifying the program to be called

The following phrases:

  • ADDRESS OF
  • LENGTH OF
  • OMITTED
  • BY VALUE
  • RETURNING

Specifying the called program-name in an alphabetic or zoned-decimal data item

Specifying an argument defined as a subordinate group item. [Standard COBOL 85 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. [Standard COBOL 85 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. [Standard COBOL 85 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. [Standard COBOL 85 requires that an unconditional GO TO be coded:

  • Only in a single-statement paragraph if no procedure-name is specified
  • Otherwise, as the last statement of a sentence.]

The MORE-LABELS format

IF statement The use of END-IF with the NEXT SENTENCE phrase. [Standard COBOL 85 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

PREVIOUS phrase

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

The following relational operators:

  • LESS THAN
  • <
  • NOT GREATER THAN
  • NOT >
  • LESS THAN OR EQUAL TO
  • <=
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

For a relative or indexed file, omission of both the INVALID KEY phrase and an applicable exception procedure

Intrinsic functions

The effect of the DATEPROC and INTDATE compiler options on the DATE-OF-INTEGER and DAY-OF-INTEGER functions

The following functions:

  • DATE-TO-YYYYMMDD
  • DATEVAL
  • DAY-TO-YYYYDDD
  • DISPLAY-OF
  • NATIONAL-OF
  • UNDATE
  • YEAR-TO-YYYY
  • YEARWINDOW
LENGTH function Specifying a pointer, the ADDRESS OF special register, or the LENGTH OF special register as an argument to the function
Compiler-directing statements

The following statements:

  • BASIS
  • CBL(PROCESS)
  • *CONTROL and *CBL
  • DELETE
  • EJECT
  • INSERT
  • READY or RESET TRACE
  • SERVICE LABEL
  • SERVICE RELOAD
  • SKIP1, SKIP2, and SKIP3
  • TITLE
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. [Standard COBOL 85 accepts only the characters used in formation of user-defined words.]

Compiler directives >>CALLINTERFACE directive

Terms of use | Feedback

Copyright IBM Corporation 1996, 2008.
This information center is powered by Eclipse technology. (http://www.eclipse.org)