COBOL source code differences in Enterprise COBOL Version 5 and Version 6
Several language elements have been removed or modified in Enterprise COBOL V5 and V6 that may require updates to your source programs.
Millennium Language Extensions
- DATE FORMAT clause
- DATEVAL intrinsic function
- UNDATE intrinsic function
- YEARWINDOW intrinsic function
LABEL declarative
- Format 2 declarative syntax:
USE...AFTER...LABEL PROCEDURE...
is no longer supported - The syntax:
GO TO MORE-LABELS
is no longer supported.
VOLATILE reserved word
Starting in Enterprise COBOL V5.2, VOLATILE is a new reserved word. Existing programs that use VOLATILE as a user-defined word (for example, as a data name or paragraph name) will get S-level diagnostic messages with Enterprise COBOL V5.2 and V6. You must change these instances of VOLATILE to other words such as VOLATILE-X, or you can use the CCCA utility to do it for you.
INSPECT...TALLYING behavior
For INSPECT...TALLYING
, previous versions
of the compiler insert zone nibbles in a signed numeric display inspected
item before performing the INSPECT. This will, for example, change
SPACES to ZEROS. COBOL V5 and later versions no longer do
this zone normalization. Having INSPECT
without a REPLACING
clause
update the inspected item was unexpected, and COBOL V5 and later versions do not do this.
There is no way to have COBOL V5 and later versions behave in the same unexpected way as COBOL V4. Adding or removing REPLACING will not replicate COBOL V4 and earlier behavior, which we consider to be in error. To avoid the unexpected behavior in COBOL V4, you can add a NUMERIC class test before the INSPECT, avoid moving spaces or alphanumeric data into the inspected item, or move zeroes into the inspected item. COBOL V5 and later versions will not unexpectedly modify the inspected data item.
01 TEST-DATA.
02 NUM-DISP PIC S9(9).
. . .
MOVE 0 To TALLY
MOVE SPACES TO TEST-DATA
INSPECT NUM-DISP TALLYING TALLY FOR ALL ZEROES
IF TALLY > 0 THEN
DISPLAY 'This is COBOL V4 or earlier'
ELSE
DISPLAY 'This is COBOL V6'
If your programs rely on
this behavior, then you can change your program to do INSPECT, with
REPLACING to, for example, replace SPACES with ZEROS in COBOL V6 programs:INSPECT NUM-DISP REPLACING ALL SPACES BY '0'
This
is effectively what COBOL V4 did, but you might have to replace other
nonnumeric content of the signed numeric display data item.Move instruction
When moving a 16-bit COMP-5 sender (PICTURE clause PIC 9(2) through PIC 9(4)), with value x'8000' or higher, to an alphanumeric data item, Enterprise COBOL V4.2 incorrectly uses an instruction that loads the value as a 32-bit value with the high sixteen bits all ones. This incorrectly changes the value that is moved to the PIC X(9) receiver. Enterprise COBOL V5 and V6 correctly load the 16-bit value as a 32-bit value with the high sixteen bits all zeros, which is correct, but is different from Enterprise COBOL V4.2.
Changes that apply to Enterprise COBOL V6 only
The following differences apply to Enterprise COBOL V6 specifically.
Reserved words
Starting in Enterprise COBOL V6.1, ALLOCATE, DEFAULT, END-JSON, FREE, JSON, and JSON-CODE are new reserved words. Existing programs that use these words as user-defined words (for example, as data names or paragraph names) will get S-level diagnostic messages with Enterprise COBOL V6. You must change instances of these reserved words to other words such as ALLOCATE-X or JSON-Y, or you can use the CCCA utility to do it for you.
Starting in Enterprise COBOL V6.2, JSON-STATUS is a new reserved word. Existing programs that use JSON-STATUS as a user-defined word (for example, as a data name or paragraph name) will get S-level diagnostic messages with Enterprise COBOL V6.2. You must change these instances of JSON-STATUS to other words such as JSON-STATUS-X, or you can use the CCCA utility to do it for you.
Starting in Enterprise COBOL V6.3, BYTE-LENGTH, JAVA, LIMIT, POINTER-32, and UTF-8 are new reserved words. Existing programs that use these words as user-defined words (for example, as data names or paragraph names) will get S-level diagnostic messages with Enterprise COBOL V6.3. You must change instances of these reserved words to other words such as BYTE-LENGTH-X or BYTE-LENGTH-Y, or you can use the CCCA utility to do it for you.
CURRENCY SIGN clause
- If the PICTURE SYMBOL phrase is not specified, then operand literal-6 can no longer be the character 'U' or the character 'u'.
- If the PICTURE SYMBOL phrase is specified, then operand literal-7 can no longer be the character 'U' or the character 'u'.
VALUE clause
In Enterprise COBOL V5 and earlier versions, a non-88 level VALUE clause in the LINKAGE SECTION or the FILE SECTION was treated as a comment and ignored.
000224 LINKAGE SECTION.
000225 01 ALPH-ITEM PIC X(4) VALUE 1234.
==000225==> IGYDS1158-I A non-level-88 "VALUE" clause was found in the
"FILE SECTION" or "LINKAGE SECTION". The "VALUE" clause was treated as comments.
However, starting in Enterprise COBOL V6.1, the VALUE clause for the LINKAGE SECTION and the FILE SECTION items is now syntax checked and has meaning.
000224 LINKAGE SECTION.
000225 01 ALPH-ITEM PIC X(4) VALUE 1234.
==000225==> IGYGR1080-S A "VALUE" clause literal was not compatible with the data
category of the subject data item. The "VALUE" clause was discarded.
- If the data VALUE literal is incompatible with the PICTURE clause, as shown in the example above, the IGYGR1080-S error message will be issued.
- If the data VALUE literal is compatible with the PICTURE clause, it will be used to initialize the data item in the LINKAGE SECTION when the data item is used in an INITIALIZE...TO VALUE statement.
In summary, a COBOL V5 program with a non-88 level VALUE clause in the LINKAGE SECTION that is compiled with an RC=0 could get an RC=12 with COBOL V6 or have the LINKAGE data item be initialized when the data item is used in an INITIALIZE...TO VALUE statement, depending on the validity of the VALUE clause literal.
CALL...USING file-name statement
The use of passing a file-name to a subprogram with the USING phrase of the CALL statement was removed in Enterprise COBOL V6.3, but is restored in Enterprise COBOL V6.3 with PTF for APAR PH20724 installed.