Undocumented OS/VS COBOL extensions that are not supported
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.
- Abbreviated combined relation conditions and use of parentheses
- OS/VS COBOL accepted the
use of parentheses within an abbreviated combined relation condition.
Enterprise COBOL supports most parenthesis usage as IBM® extensions. However, there are two differences:
- Within the scope of an abbreviated combined relation condition, Enterprise COBOL does not support
relational operators inside parentheses. For example:
A = B AND ( < C OR D)
- Some incorrect usages of parentheses in relation conditions were
accepted by OS/VS COBOL, but are not by Enterprise COBOL. For example:
(A = 0 AND B) = 0
- Within the scope of an abbreviated combined relation condition, Enterprise COBOL does not support
relational operators inside parentheses. For example:
- ACCEPT statement
- OS/VS COBOL accepted
the ACCEPT statement without the keyword FROM between the identifier
and the mnemonic or function name.
Enterprise COBOL does not accept such an ACCEPT statement.
- BLANK WHEN ZERO clause and asterisk (*) override
- In OS/VS COBOL,
if you specified the BLANK WHEN ZERO clause and the asterisk (*) as
a zero suppression symbol for the same entry, zero suppression would
override BLANK WHEN ZERO.
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.
- CLOSE . . . FOR REMOVAL statement
- OS/VS COBOL allowed the FOR REMOVAL clause for sequential files, and it had an effect on the execution of the program. Enterprise COBOL syntax-checks the statement but it has no effect on the execution of the program.
- Comparing group to numeric packed-decimal item
- OS/VS
COBOL allowed a comparison between a group and a numeric packed-decimal
item, but generated code that produced an incorrect result. For example, the result of the comparison below is the message
and is not the numerically correct"1 IS NOT > 0"
"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.
- Flow of control, no terminating statement
- In
OS/VS COBOL, it would be possible to link-edit an assembler program
to the end of an OS/VS COBOL program and have the flow of control
go from the end of the COBOL program to the assembler program.
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.
- Index names
- OS/VS COBOL allowed the use of qualified index
names.
Enterprise COBOL does not allow qualified index names; index names must be unique if referenced.
- LABEL RECORD IS statement
- OS/VS COBOL accepted
a LABEL RECORD clause without the word RECORD. You could have LABEL
IS OMITTED instead of LABEL RECORD IS OMITTED.
Enterprise COBOL does not accept such a LABEL RECORD clause.
- MOVE statement - binary value and DISPLAY value
- Although
the Enterprise COBOL TRUNC(OPT)
compiler option is recommended for compatibility with the OS/VS COBOL
NOTRUNC compiler option, you might receive different results involving
moves of fullword binary items (USAGE COMP with Picture 9(5) through
Picture 9(9)). For example:
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 statement
-
- OS/VS COBOL allowed more than one receiver with MOVE CORRESPONDING; Enterprise COBOL does not. Therefore,
you must change the following OS/VS COBOL statement:
to two Enterprise COBOL MOVE CORRESPONDING statements:MOVE CORRESPONDING GROUP-ITEM-A TO GROUP-ITEM-B GROUP-ITEM-C
MOVE CORRESPONDING GROUP-ITEM-A TO GROUP-ITEM-B MOVE CORRESPONDING GROUP-ITEM-A TO GROUP-ITEM-C
- Releases prior to Release 2.4 of OS/VS COBOL accepted nonunique
subordinate data items in the receiver of a MOVE CORRESPONDING statement; Enterprise COBOL does not. For
example:
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.
- OS/VS COBOL allowed more than one receiver with MOVE CORRESPONDING; Enterprise COBOL does not. Therefore,
you must change the following OS/VS COBOL statement:
- MOVE statement - multiple TO specification
- OS/VS
COBOL allowed the reserved word TO to precede each receiver in a MOVE
statement. For example:
MOVE aa TO bb TO cc
In Enterprise COBOL, the above statement must be changed to:MOVE aa TO bb cc
- MOVE ALL - TO PIC 99
- OS/VS
COBOL allowed group moves into a fixed numeric receiving field. For
example:
where,MOVE ALL ' ' TO num1
num1
is PIC 99.Enterprise COBOL does not allow the above case. In Enterprise COBOL, you can change the example to the following statement and it would be accepted:MOVE ALL ' ' TO num1(1:)
- MOVE statement - warning message for numeric truncation
- OS/VS COBOL issued a warning message
for a MOVE statement with a numeric receiver that would result in
a loss of digits. For example:
77 A PIC 999. 77 B PIC 99. . . . MOVE A TO B.
You can get the same behavior with Enterprise COBOL if the compiler option DIAGTRUNC is in effect.
- OCCURS clause
- OS/VS COBOL allowed a nonstandard
order for phrases following the OCCURS clause; Enterprise COBOL does not. For example, the following code sequence would be allowed in OS/VS COBOL:
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.
In Enterprise COBOL, the above example must be changed to the following code sequence: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.
- OPEN REVERSED statement
- OS/VS COBOL accepted the REVERSED phrase for multireel files; Enterprise COBOL does not.
- PERFORM statement - second UNTIL
- OS/VS
COBOL allowed a second UNTIL in a PERFORM statement, as in the following
example:
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.
- Periods in Area A
- OS/VS COBOL allowed you to code a period in Area A following an Area-A item (or no item) that was not valid. With Enterprise COBOL, a period in Area A must be preceded by a valid Area-A item.
- Periods, consecutive in any division
- OS/VS COBOL allowed you to code two consecutive
periods in any division.
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.
The following code would be accepted by OS/VS COBOL, but would receive a severe (RC = 12) error and a warning (RC = 4) under Enterprise COBOL:WORKING-STORAGE SECTION. 01 A PIC 9.. . . . MOVE 1 TO A.. . . GOBACK.
- Periods missing at the end of SD, FD, or RD
- A
period is required at the end of a sort, file, or report description,
preceding the 01-level indicator.
OS/VS COBOL diagnosed the missing period with a warning message (RC = 4).
Enterprise COBOL issues an error message (RC = 8).
- Periods missing on paragraphs
- Releases prior to Release 2.4 of OS/VS COBOL accepted paragraph names not followed by a period. Release 2.4 of OS/VS COBOL issued a warning message (RC = 4) whereas Enterprise COBOL issues an error message (RC = 8) .
- PICTURE string
- OS/VS
COBOL accepted a PICTURE string with all Z's to the left of the implied
decimal point, a Z immediately to the right of the implied decimal
point, but ending with a 9 or 9-. For example:
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 eitherZZ
or99
. - PROGRAM-ID names, nonunique
- OS/VS COBOL allowed a data-name or paragraph-name to be the same as the PROGRAM-ID name. Enterprise COBOL requires the PROGRAM-ID name to be unique.
- Qualification - using the same phrase repeatedly
-
A of B of B
OS/VS COBOL allowed repeating of phrases; Enterprise COBOL does not.
- READ statement - redefined record keys in the KEY phrase
- OS/VS COBOL accepted implicitly or explicitly redefined record
keys in the KEY phrase of the READ statement.
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.
- RECORD CONTAINS n CHARACTERS clause
- In
variation with the 74 COBOL Standard, the RECORD CONTAINS n CHARACTERS
clause of an OS/VS COBOL program was overridden if an OCCURS DEPENDING
ON clause was specified in the FD, and produced a file containing
variable-length records instead of fixed-length records.
Under Enterprise COBOL, the RECORD CONTAINS n CHARACTERS clause produces a file containing fixed-length records.
- RECORD KEY phrase and ALTERNATE RECORD KEY phrase
- OS/VS COBOL allowed the leftmost character position of the ALTERNATE
RECORD KEY data-name-4 to be the same as the leftmost
character position of the RECORD KEY or of any other ALTERNATE RECORD
KEY phrases.
Enterprise COBOL does not allow this.
- Record length, obtaining from QSAM RDW
- In OS/VS COBOL, you can obtain the record length for files that
have variable-length records from the RDW by using invalid negative
subscripts.
In Enterprise COBOL, the RDW for variable files in the area preceding the record content is not available. To migrate from previous COBOL products, use the Format 3 RECORD clause in FD entries to set or obtain the length of variable records when the information is not in the record itself. The syntax contains RECORD IS VARYING DEPENDING ON data-name-1. data-name-1 is defined in WORKING-STORAGE. After the compiler reads a variable record, the length of the data read is automatically stored at data-name-1. For example:
For more information about the RECORD clause, see the Enterprise COBOL for z/OS® Language Reference.FILE SECTION. FD THE-FILE RECORD IS VARYING DEPENDING ON REC-LENGTH. 01 THE-RECORD PICTURE X(5000) . WORKING-STORAGE SECTION. 01 REC-LENGTH PICTURE 9(5) COMPUTATIONAL. 01 SAVED-RECORD PICTURE X(5000). PROCEDURE DIVISION. * Read a record of unknown length. READ THE-FILE. DISPLAY REC-LENGTH. * or use REC-LENGTH to access the right amount of data: MOVE THE-RECORD (1:REC-LENGTH) TO SAVED-RECORD.
- REDEFINES clause in SD or FD entries
- Releases prior to OS/VS COBOL Release 2.4 accepted
a REDEFINES clause in a level-01 SD or FD; Enterprise COBOL and OS/VS COBOL
Release 2.4 do not. For example, the following code sequence is not valid:
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.
- REDEFINES clause with tables
- OS/VS COBOL allowed you to specify tables within the REDEFINES
clause. For example, OS/VS COBOL would issue a warning message (RC
= 4) for the following example:
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.
- Relation conditions
- Releases
prior to OS/VS COBOL Release 2.4 accepted operators in relation conditions
that are not valid. The following table lists the operators accepted
by OS/VS COBOL Release 2.3 that are not accepted by Enterprise COBOL. It also shows
the valid coding for Enterprise COBOL programs.
OS/VS COBOL R2.3 Enterprise COBOL = TO = or EQUAL TO > THAN > or GREATER THAN < THAN < or LESS THAN - RENAMES clause - nonunique, nonqualified data names
- No MIGR message is issued if the RENAMES clause in your OS/VS COBOL program references a nonunique, nonqualified data name. However, Enterprise COBOL does not support the use of nonunique, nonqualified data names.
- SELECT statement without a corresponding FD
- OS/VS COBOL accepted a SELECT statement that does not have a corresponding FD entry; Enterprise COBOL does not.
- SORT statement
- At early maintenance levels, the OS/VS COBOL compiler accepted
the UNTIL and TIMES phrases in the SORT statement, for example:
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.
- SORT or MERGE
- With OS/VS COBOL, a MOVE to the SD buffer before the first RETURN
in a SORT or MERGE output PROCEDURE did not overlay the data of the
first record.
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.
- STRING statement - sending field identifier
- OS/VS COBOL allowed a numeric sending field identifier that is not an integer. Under Enterprise COBOL, a numeric sending field identifier must be an integer.
- UNSTRING statement - coding with 'OR', 'IS', or a numeric edited item
- OS/VS
COBOL would not issue a diagnostic error message for UNSTRING statements
containing any of the following instances of coding that is not valid:
- Lack of the required word
OR
between literal-1 and literal-2, as in:UNSTRING A-FIELD DELIMITED BY '-' ',' INTO RECV-FIELD-1 POINTER PTR-FIELD.
- Presence of the extraneous word
IS
in specifying a pointer, as in:UNSTRING A-FIELD DELIMITED BY '-' OR ',' INTO RECV-FIELD-2 POINTER IS PTR-FIELD.
- Use of a numeric edited item as the source of an UNSTRING statement,
as in:
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.
- Lack of the required word
- UNSTRING statement - multiple INTO phrases
- OS/VS
COBOL issued a warning (RC = 4) message when multiple INTO phrases
were coded. For example:
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.
- VALUE clause - signed value in relation to the PICTURE clause
- In
OS/VS COBOL, the VALUE clause literal could be signed if the PICTURE
clause was unsigned.
In Enterprise COBOL, the VALUE clause literal must match the PICTURE clause and the sign must be removed.