This section consists primarily of COBOL statements that are not flagged by the MIGR option. These statements were accepted by the OS/VS COBOL compiler; some are not accepted by Enterprise COBOL.
A = B AND ( < C OR D)
(A = 0 AND B) = 0
Enterprise COBOL does not accept such an ACCEPT statement.
Enterprise COBOL does not accept these two language elements when they are specified for the same data description entry. Thus Enterprise COBOL must not contain instances of both the clause and the symbol in one data description entry.
If you have specified both the BLANK WHEN ZERO clause and the asterisk as a zero suppression symbol in your OS/VS COBOL programs, to get the same behavior in Enterprise COBOL, remove the BLANK WHEN ZERO clause.
"1 IS NOT > 0"and is not the numerically correct
"1 > 0"
05 COMP-TABLE.
10 COMP-PAY PIC 9(4).
10 COMP-HRS PIC 9(3).
05 COMP-ITEM PIC S9(7) COMP-3.
PROCEDURE DIVISION.
MOVE 0 TO COMP-PAY COMP-HRS.
MOVE 1 TO COMP-ITEM.
IF COMP-ITEM > COMP-TABLE
DISPLAY '1 > 0'
ELSE
DISPLAY '1 IS NOT > 0'.
Enterprise COBOL does not allow such a comparison.
If your OS/VS COBOL programs issue dynamic CALL statements when running on CICS under Language Environment, the programs will abend with abend code U3504.
Enterprise COBOL programs can use dynamic CALL statements to call other Enterprise COBOL programs or even PL/I and C/C++ programs under CICS.
In Enterprise COBOL, if you do not code a terminating statement at the end of your program (STOP RUN or GOBACK), the program will terminate with an implicit GOBACK. The flow of control cannot go beyond the end of the COBOL program.
If you have programs that rely on 'falling through the end' into another program, change the code to a CALL interface to the other program.
Enterprise COBOL does not allow qualified index names; index names must be unique if referenced.
Enterprise COBOL does not accept such a LABEL RECORD clause.
WORKING-STORAGE SECTION. 01 WK1 USAGE COMP-4 PIC S9(9). PROCEDURE DIVISION. MOVE 1234567890 to WK1 DISPLAY WK1. GOBACK.
This example actually shows COBOL coding that is not valid, since 10 digits are being moved into a 9-digit item.
For example, the results are as follows when compiled with the following compiler options:
| OS/VS COBOL NOTRUNC | Enterprise COBOL TRUNC(OPT) | |
|---|---|---|
| Binary value | x'499602D2' | x'0DFB38D2' |
| DISPLAY value | 234567890 | 234567890 |
For OS/VS COBOL, the binary value contained in the binary data item is not the same as the DISPLAY value. The DISPLAY value is based on the number of digits in the PICTURE clause and the binary value is based on the size of the binary data item, in this case, 4 bytes. The actual value of the binary data item in decimal digits is 1234567890.
For Enterprise COBOL, the binary value and the DISPLAY value are equal because the truncation that occurred was based on the number of digits in the PICTURE clause.
This situation is flagged by MIGR in OS/VS COBOL and by Enterprise COBOL when compiled with TRUNC(OPT).
MOVE CORRESPONDING GROUP-ITEM-A TO GROUP-ITEM-B GROUP-ITEM-Cto two Enterprise COBOL MOVE CORRESPONDING statements:
MOVE CORRESPONDING GROUP-ITEM-A TO GROUP-ITEM-B MOVE CORRESPONDING GROUP-ITEM-A TO GROUP-ITEM-C
01 KANCFUNC.
03 CL PIC XX.
03 KX9 PIC XX.
03 CC PIC XX.
01 HEAD1-AREA.
03 CL PIC XX.
03 KX9 PIC XX.
03 CC PIC XX.
03 KX9 PIC XX.
.
.
.
MOVE CORR KANCFUNC to HEAD1-AREA.
For Enterprise COBOL, change the data items in the receiver to have unique names.
MOVE aa TO bb TO cc
MOVE aa TO bb cc
MOVE ALL ' ' TO num1where, num1 is PIC 99.
Enterprise COBOL does not allow the above case.
77 A PIC 999.
77 B PIC 99.
.
.
.
MOVE A TO B.
VS COBOL II, COBOL for MVS & VM, and COBOL for OS/390 & VM, Version 2 Release 1 do not issue a warning message for this case.
COBOL for OS/390 & VM, Version 2 Release 2 and Enterprise COBOL issue a warning message if the new compiler option DIAGTRUNC is in effect.
01 D PIC 999.
01 A.
02 B OCCURS 1 TO 200 TIMES
ASCENDING KEY C
DEPENDING ON D
INDEXED BY H.
02 C PIC 99.
01 D PIC 999.
01 A.
02 B OCCURS 1 TO 200 TIMES
DEPENDING ON D
ASCENDING KEY C
INDEXED BY H.
02 C PIC 99.
PERFORM CHECK-FOR-MATCH THRU CHECK-FOR-MATCH-EXIT
UNTIL PARM-COUNT = 7
OR UNTIL SSREJADV-EOF.
Enterprise COBOL does not allow a second UNTIL statement. It must be removed as shown in the following example:
PERFORM CHECK-FOR-MATCH THRU CHECK-FOR-MATCH-EXIT
UNTIL PARM-COUNT = 7
OR SSREJADV-EOF.
Enterprise COBOL issues a warning message (RC = 4) if two periods in a row are found in the PROCEDURE DIVISION, and a severe message (RC = 12) if two periods in a row are found in either the ENVIRONMENT DIVISION or the DATA DIVISION.
WORKING-STORAGE SECTION.
01 A PIC 9.
.
.
.
MOVE 1 TO A.
.
.
GOBACK.
OS/VS COBOL diagnosed the missing period with a warning message (RC = 4).
Enterprise COBOL issues an error message (RC = 8).
05 WEIRD-NUMERIC-EDITED PIC Z(11)VZ9.
Enterprise COBOL does not accept statements such as the statements in the example above. You must change the Z9 to either ZZ or 99.
A of B of B
OS/VS COBOL allowed repeating of phrases; Enterprise COBOL does not.
Enterprise COBOL accepts only the names of the data items that are specified as record keys in the SELECT clause for the file being read.
Under Enterprise COBOL, the RECORD CONTAINS n CHARACTERS clause produces a file containing fixed-length records.
Enterprise COBOL does not allow this.
SD ...
01 SORT-REC-HEADER.
05 SORT-KEY PIC X(20).
05 SORT-HEADER-INFO PIC X(40).
05 FILLER PIC X(20).
01 SORT-REC-DETAIL REDEFINES SORT-REC-HEADER.
05 FILLER PIC X(20).
05 SORT-DETAIL-INFO PIC X(60).
To get similar function in Enterprise COBOL, delete the REDEFINES clause.
01 E.
03 F OCCURS 10.
05 G PIC X.
03 I REDEFINES F PIC X.
Enterprise COBOL does not allow tables to be redefined, and issues a severe (RC = 12) message for the example above.
| OS/VS COBOL R2.3 | Enterprise COBOL |
|---|---|
| = TO | = or EQUAL TO |
| > THAN | > or GREATER THAN |
| < THAN | < or LESS THAN |
SORT FILE-1
ON ASCENDING KEY AKEY-1
INPUT PROCEDURE IPROC-1
OUTPUT PROCEDURE OPROC-1
UNTIL AKEY-1 = 99.
SORT FILE-2
ON ASCENDING KEY AKEY-2
INPUT PROCEDURE IPROC-2
OUTPUT PROCEDURE OPROC-2
10 TIMES.
Enterprise COBOL does not accept statements such as the statements in the example above.
In a SORT statement, the correct syntax allows ASCENDING KEY or DESCENDING KEY followed by a data-name which is the sort key. The word KEY is optional.
OS/VS COBOL accepted IS if used following ASCENDING KEY. Enterprise COBOL does not accept IS in this context. For example:
SORT SORT-FILE
ASCENDING KEY IS SD-NAME-FIELD
USING INPUT-FILE
GIVING SORTED-FILE.
In Enterprise COBOL such a MOVE would overlay the data of the first record. During a SORT or MERGE operation, the SD data item is used. You must not use it in the OUTPUT PROCEDURE before the first RETURN statement executes. If data is moved into this record area before the first RETURN statement, the first record to be returned will be overwritten.
UNSTRING A-FIELD DELIMITED BY '-' ','
INTO RECV-FIELD-1
POINTER PTR-FIELD.
UNSTRING A-FIELD DELIMITED BY '-' OR ','
INTO RECV-FIELD-2
POINTER IS PTR-FIELD.
01 NUM-ED-ITEM PIC $$9.99+
.
.
.
UNSTRING NUM-ED-ITEM DELIMITED BY '$'
INTO RECV-FIELD-1
POINTER PTR-FIELD
Enterprise COBOL allows only nonnumeric data items as senders in the UNSTRING statement.
Enterprise COBOL issues a message if an UNSTRING statement containing any of these errors is encountered.
UNSTRING ID-SEND DELIMITED BY ALL "*" INTO ID-R1 DELIMITER IN ID-D1 COUNT IN ID-C1 INTO ID-R2 DELIMITER IN ID-D2 COUNT IN ID-C2 INTO ID-R2 DELIMITER IN ID-D3 COUNT IN ID-C3
Enterprise COBOL does not allow multiple INTO phrases in an UNSTRING statement.
In Enterprise COBOL, the VALUE clause literal must match the PICTURE clause and the sign must be removed.