2002/2014 COBOL Standard features implemented in Enterprise COBOL Version 3 or later versions
Beginning with Enterprise COBOL Version 3, substantive changes are implemented according to the 2002 COBOL Standard and 2014 COBOL Standard. This topic lists those changes that will potentially affect existing COBOL programs and those changes that will not affect existing COBOL programs.
Features | Notes |
---|---|
SPECIAL-NAMES paragraph, CURRENCY SIGN clause | The letters 'N', 'n', 'E' and 'e' are now used as picture symbols. The letter 'N' or 'E' can no longer be specified as a currency sign in the CURRENCY SIGN clause. |
SAME clause | File-names referenced in a SAME clause shall be described in the FILE-CONTROL paragraph of the source element that contains the SAME clause. |
Executable code production | The implementor is not required to produce an executable object program if a fatal exception condition for which checking is not enabled is detected by the compiler. |
Exponentiation | If the value of an expression to be raised to a power is less than zero, the following condition shall be true for the exponent: (FUNCTION FRACTION-PART (exponent) = 0). Otherwise, the EC-SIZE-EXPONENTIATION exception exists and the size error condition is raised. |
CORRESPONDING order | The order of execution of the implied statements created for corresponding operands for ADD, MOVE, and SUBTRACT with the CORRESPONDING phrase is defined to be the order of the specification of the operands in the group following the word CORRESPONDING. The previous COBOL standard did not specify an order. In addition, the evaluation of subscripts for the implied statements is done only once, at the start of the execution of the actual ADD, MOVE, or SUBTRACT statement. The previous COBOL standard implied this, but was not specific. |
Sending and receiving operands | The terms sending operand and receiving operand have been defined. |
Incompatible data clarification | The conditions that cause the incompatible data condition are specified explicitly. They are limited to boolean, numeric, and numeric-edited sending operands. |
EVALUATE statement, sequence of execution | The sequence of evaluation of selection subjects and objects is now defined to be from left to right and selection objects are evaluated as each WHEN phrase is processed. When a WHEN phrase is selected, no more selection objects are evaluated. |
Features | Notes |
---|---|
ACCEPT statement four-digit year | The capability to access the four-digit year of the Gregorian calendar is added to the ACCEPT statement. |
Apostrophe as quotation mark | The apostrophe character and the quotation mark can be used in the opening and closing delimiters of alphanumeric, boolean, and national literals. A given literal can use either the apostrophe or the quotation mark, but both the starting and ending characters are required to be the same. Whichever character is used, it is necessary to double that character to represent one occurrence of the character within the literal. Both formats can be used in a single source element. |
Arithmetic operators | No space is required between a left parenthesis and unary operator or between a unary operator and a left parenthesis. |
AT END phrase | The AT END phrase of the READ statement does not have to be specified if there is no applicable USE statement. |
BINARY and floating point data | Two new representations of numeric data type are introduced, a binary representation that holds data in a machine-specific way and is not restricted to decimal ranges of values, and a floating-point representation. The floating-point type exists both in a numeric form, with a machine-specific representation, and in a numeric-edited form. |
CALL argument level numbers (any) | CALL arguments can be elementary or groups with any level number. Formerly, they had to be elementary or have a level number of 1 or 77. |
CALL BY CONTENT parameter difference | A parameter passed by content does not have to have the same description as the matching parameter in the called program. |
CALL parameter length difference | The size of an argument in the USING phrase of the CALL statement can be greater than the size of the matching formal parameter if either the argument or the formal parameter is a group item. Formerly, the sizes were required to be the same. |
CALL recursively | The capability of calling an active COBOL program has been added to COBOL. |
COBOL words reserved in context | Certain words added to the COBOL standard are reserved only in the contexts in which they are specified and were not added to the reserved word list. See Context-sensitive words for details. |
CODE clause (Report Writer) | The identifier phrase is provided in the CODE clause in the report description entry. |
COLUMN clause | A relative form is provided using PLUS integer, by analogy with LINE; COLUMN RIGHT and COLUMN CENTER are provided, allowing alignment of a printable item at the right or center; and COL, COLS, and COLUMNS are allowed as synonyms for COLUMN. |
COLUMN, LINE, SOURCE, and VALUE clauses | These clauses can have more than one operand in a report group description entry. |
Comment lines anywhere in a compilation group | Comment lines can be written as any line in a compilation group, including before the identification division header. |
Compiler directives |
|
Control data name | This is allowed to be omitted on TYPE CH/CF if only one control is defined. |
Conversion from two-digit year to four-digit year | There are three functions for converting from a two-digit year to a four-digit year. DATE-TO-YYYYMMDD, DAY-TO-YYYYDDD, and YEAR-TO-YYYY convert from YYnnnn to YYYYnnnn, YYnnn to YYYYnnn, and YY to YYYY, respectively. |
COPY statement | An alphanumeric literal can be specified in place of text-name-1 or library-name-1. When more than one COBOL library is referenced, text-name need not be qualified when the library text resides in the default library. The ability to nest COPY statements is provided. Library text incorporated as a result of processing a COPY statement without a REPLACING phrase can contain a COPY statement without a REPLACING phrase. A SUPPRESS PRINTING phrase is added to the COPY statement to suppress listing of library text incorporated as a result of COPY statement processing. |
COPY and REPLACE statement partial word replacement | LEADING and TRAILING phrases of the REPLACE statement and the REPLACING phrase of the COPY statement allow replacement of partial words in source text and library text. This is useful for prefixing and postfixing names. |
Currency sign extensions | The CURRENCY SIGN clause has been extended to allow for national characters and for multiple distinct currency signs, which can have any length. |
DISPLAY statement | If the literal in a DISPLAY statement is numeric, it can be signed. |
DIVIDE BY zero | DIVIDE BY zero conforms to the 2002 COBOL Standard. Nothing has changed in IBM® COBOL, but the Standard is changed so that now Enterprise COBOL is conforming. (Enterprise COBOL was not conforming to the 85 COBOL Standard for DIVIDE BY zero.) |
Dynamic-length elementary items | The addition of the DYNAMIC LENGTH clause provides the ability to describe a data item of varying size. |
Dynamic storage allocation | ALLOCATE and FREE statements are provided for obtaining storage dynamically. This storage is addressed by pointer data items. |
EXIT statement | The ability to immediately exit an inline PERFORM statement, a paragraph, or a section has been added. |
EXIT PROGRAM allowed as other than last statement | EXIT PROGRAM is allowed to appear as other than the last statement in a consecutive sequence of imperative statements. |
FILLER | FILLER is allowed in the report section. |
Floating comment delimiters |
|
FUNCTION All INTRINSIC | The REPOSITORY paragraph supports a function specifier, and for some intrinsic functions, the keyword FUNCTION is optional when a function is included in the REPOSITORY paragraph. |
GOBACK statement | A GOBACK statement has been added that always returns control, either to the operating system or to the calling runtime element. |
Hexadecimal literals | The ability was added to specify alphanumeric, boolean, and national literals using hexadecimal (radix 16) notation. |
Inline comment | A comment can be written on a line following any character-strings of the source text or library text that are written on that line. An inline comment is introduced by the two contiguous characters '*>'. |
Index data item | The definition of an index data item can include the SYNCHRONIZED clause. |
INITIALIZE statement, FILLER phrase | FILLER data items can be initialized with the INITIALIZE statement. |
INITIALIZE statement, VALUE phrase | A VALUE phrase can be specified in the INITIALIZE statement to cause initialization of elementary data items to the literal specified in the VALUE clause of the associated data description entry. |
Intrinsic function facility | Previously, the intrinsic function facility was a separate module and its implementation was optional. The intrinsic function facility is integrated into the specification and it shall be implemented by a conforming implementation |
New intrinsic functions | New intrinsic functions are added:
Support for industry standard date and time formats New date
and time intrinsic functions are introduced that support encoding
and decoding of date and time information to and from formats specified
in ISO 8601, and that support encoding and decoding date and time
information to and from integers that are suitable for arithmetic.
These new intrinsic functions are:
|
INVALID KEY phrase | The INVALID KEY phrase does not have to be specified if there is no applicable USE statement. |
LOCAL-STORAGE SECTION | A facility was added to define data that is set to its initial values each time a function, method, or program is activated. Each instance of this source element has its own copy of this data. |
National character handling | The capability is added for using large character sets, such as ISO/IEC 10646-1, in source text and library text and in data at execution time. Class national and categories national and national-edited are specified by picture character-strings containing the symbol 'N'; national literals are identified by a separator N", N', NX", or NX'. Usage national specifies representation of data in a national character set. User-defined words can contain extended letters. Processing of data of class national is comparable to processing data of class alphanumeric, though there are some minor differences. Conversions between data of classes alphanumeric and national are provided by intrinsic functions. |
Object orientation | Support for object-oriented programming has been added. |
OCCURS clause | Repetition vertically or horizontally and a STEP phrase are added for Report Writer. |
Optional word OF | Allowed after SUM. |
Optional word FOR and ON | Allowed after TYPE CH or CF. |
OR PAGE phrase of the CONTROL HEADING phrase | This enables the control heading group to be printed at the top of each page and after a control break. |
PAGE FOOTING report group | Such a group is allowed to have all relative LINE clauses. |
PAGE LIMIT clause | New COLUMNS phrase is provided to define maximum number of horizontal print positions in each report line and a LAST CONTROL HEADING phrase was added. |
Paragraph-name | A paragraph-name is not required at the beginning of the procedure division or a section. |
PERFORM statement | A common exit for multiple active PERFORM statements is allowed. |
PICTURE clause | The maximum number of characters that can be specified in a picture character-string is increased from 30 to 50. The symbol 'E' can be used in a PICTURE character-string to specify a floating-point numeric-edited data item. The symbol 'N' can be used in a PICTURE character-string to specify a national or a national-edited data item. When the last symbol of a PICTURE character-string is a period or a comma, one or more spaces can precede the following separator period. It was unclear in the previous standard whether a space could precede the separator period in this context. |
PLUS and MINUS | The symbol + or - is synonymous with PLUS or MINUS, respectively, in the COLUMN and LINE clauses. |
Pointer data | A new class of data is introduced, a pointer type that holds data and program addresses in a machine-specific or system-specific way. |
PRESENT WHEN clause | The PRESENT WHEN clauses allows lines and printable items, or groups of them, to be printed or not, depending on the truth value of a condition. |
Program-names as literals | The option to specify a literal as the program-name to be externalized was added for names that are not valid COBOL words or need to be case-sensitive. |
RECORD KEY and ALTERNATE RECORD KEY | Keys for indexed files can be made up from more than one component. |
Report Writer | Previously, the Report Writer was a separate module and its implementation was optional. The Report Writer facility is integrated into the specification and it shall be implemented by a conforming implementation. |
Report Writer national character support | The capability of printing national characters and alphanumeric characters in a report is provided. |
Function specifier | The REPOSITORY paragraph supports function specifier, and for some intrinsic functions, the key word FUNCTION is optional when a function is included in the REPOSITORY paragraph. |
SIGN clause in a report description entry | The SEPARATE phrase is no longer required in a report description entry and the SIGN clause can be specified at the group level. |
SORT statement | A SORT statement can be used to sort a table. This sort can be done using the fields specified in the KEY phrase defining the table, by using the entire table element as the key, or by using specified key data items. GIVING files in a SORT statement can now be specified in the same SAME RECORD AREA clause. |
SOURCE clause in a report description entry | The sending operand can be a function-identifier. An arithmetic-expression is allowed as an operand and a ROUNDED phrase was added. |
SUM clause in a report description entry | The SUM clause was extended in the following
ways:
|
Underscore (_) character | The basic special characters of the COBOL character repertoire have been expanded to include the underscore (_) character, which can be used in the formation of COBOL words. |
UNSTRING statement | The sending operand can be reference modified. |
USE BEFORE REPORTING | The effect of GLOBAL in a report description and a USE declarative is further elucidated. |
VALUE clause, WHEN SET TO FALSE phrase in data division | The WHEN SET TO FALSE phrase allows specification of a FALSE condition value. This value is moved to the associated conditional variable when the SET TO FALSE statement is executed for the associated condition-name. |
VARYING clause | A VARYING clause is provided in the validate and Report Writer facilities to be used with an OCCURS clause. |
WITH RESET phrase | This was added to the NEXT PAGE phrase of the
NEXT GROUP clause to reset PAGE-COUNTER back to 1. Note: REPORT
WRITER features such as CODE clause, COLUMN clause, control data name,
CONTROL HEADING, PAGE FOOTING, PAGE LIMIT, SUM clause, and report
description entries are supported via the optional Report Writer Precompiler.
|