Incompatibilities between ANSI COBOL'74 and ANSI COBOL'85
The following paragraphs summarize the syntax and run-time
incompatibilities between ANSI COBOL'74 and ANSI COBOL'85.
Syntax Incompatibilities
Syntax incompatibilities are:
* The keyword ALPHABET must precede each alphabet name within the
ALPHABET-NAME clause of the SPECIAL-NAMES paragraph.
* New reserved words have been added. Refer to Appendix F for
more information.
* COPY REPLACING does not allow pseudo-text-1 to contain only a
comma or semicolon.
Run-time Incompatibilities
Run-time incompatibilities are:
* When a receiving item is a variable length data item and contains
the object of the DEPENDING ON phrase, the maximum length is used.
* A data item appearing in the USING phrase of the PROCEDURE
DIVISION header must not have a REDEFINES clause in its data
description entry.
* The following cases of exponentiation are now defined:
* If a value less than or equal to zero is raised to a power
of zero, the size error condition occurs.
* If no real number occurs as a result of the evaluation, the
size error condition occurs. For example, -4**.5
* The CANCEL statement closes all open files.
* When there is no next executable statement in a called program, an
implicit EXIT PROGRAM statement is executed.
* Within the VARYING...AFTER phrase of the PERFORM statement,
identifier-2 is augmented before identifier-5 is set. In HP COBOL
II, identifier-5 was set before identifier-2 was augmented.
* New I-O status codes have been specified. Refer to Table C-1
for more information.
* STOP RUN closes all files.
Table C-1 describes the difference between the I/O status codes
received using the ANSI74 and ANSI85 entry points. It shows the
equivalent ANSI74 codes for the new ANSI85 codes and any difference in
execution for these codes as well as codes whose definition has changed.
Table C-1. New I-O Status Codes
----------------------------------------------------------------------------------------
| | | | |
| ANSI85 | ANSI74 | New, Old, or | Execution Differences between |
| Status Code | Status Code | Changed | the Entry Points |
| | | | |
----------------------------------------------------------------------------------------
| | | | |
| 00 | | Old | |
| | | | |
----------------------------------------------------------------------------------------
| | | | |
| 02 | | Old | |
| | | | |
----------------------------------------------------------------------------------------
| | | | |
| 04 | 00 | New | None |
| | | | |
----------------------------------------------------------------------------------------
| | | | |
| 05 | 00 | New | None |
| | | | |
----------------------------------------------------------------------------------------
| | | | |
| 07 | 00 | New | None |
| | | | |
----------------------------------------------------------------------------------------
| | | | |
| 10 | | Old | |
| | | | |
----------------------------------------------------------------------------------------
| | | | |
| 14 | 00 | New | Using ANSI74, the READ |
| | | | successfully executes. Using |
| | | | ANSI85, the READ fails because |
| | | | the value of the data item is |
| | | | greater than the PICTURE that |
| | | | describes the key. |
| | | | |
----------------------------------------------------------------------------------------
| | | | |
| 21 | | Old | |
| | | | |
----------------------------------------------------------------------------------------
| | | | |
| 22 | | Old | |
| | | | |
----------------------------------------------------------------------------------------
| | | | |
| 23 | | Old | |
| | | | |
----------------------------------------------------------------------------------------
| | | | |
| 24 | 24 | Changed | In addition to the old causes |
| | | | for 24, ANSI85 returns this |
| | | | code when the value of the |
| | | | data item is greater than the |
| | | | PICTURE that describes it. |
| | | | |
----------------------------------------------------------------------------------------
| | | | |
| 30 | | Old | |
| | | | |
----------------------------------------------------------------------------------------
| | | | |
| 34 | | Old | |
| | | | |
----------------------------------------------------------------------------------------
| | | | |
| 35 | 9x | New | The file is not created using |
| | | | ANSI85, it is created in |
| | | | ANSI74 for an OPEN with the |
| | | | I-O or EXTEND phrase. |
| | | | |
----------------------------------------------------------------------------------------
| | | | |
| 37 | 00 | New | ANSI74 opens the file and the |
| | | | program continues to execute, |
| | | | however the program might |
| | | | abort later for another |
| | | | reason. ANSI85 does not open |
| | | | the file and a permanent error |
| | | | condition exists for that |
| | | | file. |
| | | | |
----------------------------------------------------------------------------------------
Table C-1. New I-O Status Codes (cont.)
-------------------------------------------------------------------------------------------------
| | | | |
| ANSI85 | ANSI74 | New, Old, or | Execution Differences between |
| Status Code | Status Code | Changed | the Entry Points |
| | | | |
-------------------------------------------------------------------------------------------------
| [REV BEG] | | | |
| | | | |
| 38 | 00 | New | Using ANSI74, the OPEN fails |
| | | | and a message is[REV END] |
| | | | printed even though an error |
| | | | status code is not returned. |
| | | | Using ANSI85, the OPEN fails |
| | | | and a permanent error |
| | | | condition exists for that |
| | | | file. |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| 39 | 00 | New | ANSI74 entry point |
| | | | successfully opens the file |
| | | | and may print an error |
| | | | message. ANSI85 treats it as |
| | | | a permanent error. |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| 41 | 9x | New | None |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| 42 | 9x | New | None |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| 43 | 9x or 00 | New | No difference for a REWRITE |
| | | | statement. ANSI74 entry point |
| | | | executes a DELETE statement |
| | | | successfully.[REV BEG] |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| 44 | 00 | New | ANSI74 executes the statement |
| | | | successfully.[REV END] In |
| | | | ANSI85 the statement is |
| | | | unsuccessful due to a logic |
| | | | error. |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| 46 | 10 | New | ANSI74 entry point continues |
| | | | to return AT END condition or |
| | | | read error condition. |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| 47 | 9x or 00 | New | Using ANSI74, if the file is |
| | | | not open then a 9x status is |
| | | | returned. If the file is |
| | | | opened with the wrong mode, a |
| | | | 9x status is sometimes |
| | | | returned; sometimes it |
| | | | continues to execute |
| | | | correctly. |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| 48 | 9x or 00 | New | Using ANSI74, if the file is |
| | | | not open then a 9x status is |
| | | | returned. If the file is |
| | | | opened with the wrong mode, a |
| | | | 9x status is sometimes |
| | | | returned; sometimes it |
| | | | continues to execute |
| | | | correctly. |
| | | | |
-------------------------------------------------------------------------------------------------
| | | | |
| 49 | 9x or 00 | New | Using ANSI74, if the file is |
| | | | not open then a 9x status is |
| | | | returned. If the file is |
| | | | opened with the wrong mode, a |
| | | | 9x status is sometimes |
| | | | returned; sometimes it |
| | | | continues to execute |
| | | | correctly. |
| | | | |
-------------------------------------------------------------------------------------------------