Language elements that changed from OS/VS COBOL
Several OS/VS COBOL language elements are changed in Enterprise COBOL in order to conform to 85 COBOL Standard.
For some elements, the syntax of the language is different. For others, the language syntax is unchanged, but the execution results can be different because semantics changed.
- ALPHABETIC class changes
- In OS/VS COBOL, only uppercase letters and the space
character were considered to be ALPHABETIC.
In Enterprise COBOL, uppercase letters, lowercase letters, and the space character are considered to be ALPHABETIC.
If your OS/VS COBOL program uses the ALPHABETIC class test, and the data tested consists of mixed uppercase and lowercase letters, there can be differences in execution results. In such cases, you can ensure identical results by substituting the Enterprise COBOL ALPHABETIC-UPPER class test for the OS/VS COBOL ALPHABETIC test.
- ALPHABET-NAME clause changes: ALPHABET keyword
-
In OS/VS COBOL, the keyword ALPHABET was not allowed in the
ALPHABET-NAMES clause.
In Enterprise COBOL, there is a keyword ALPHABET and it is required.
- Arithmetic statement changes
-
Enterprise COBOL supports the following arithmetic items with
enhanced accuracy:
- Use of floating-point data items
- Use of floating-point literals
- Use of fractional exponentiation
Therefore, for arithmetic statements that contain these items, Enterprise COBOL might provide more accurate results than OS/VS COBOL. You will need to test your applications to verify that these changes do not have a negative impact on them.
- ASSIGN clause changes
-
Enterprise COBOL supports only the following format of the
ASSIGN clause:
Where assignment-name can have the following forms:ASSIGN TO assignment-name
- QSAM files
- [comments-][S-]name
- VSAM sequential files
- [comments-][AS-]name
- VSAM indexed or relative files
- [comments-]name
- LINE SEQUENTIAL files
- [comments-]name
If your OS/VS COBOL program uses other formats of the ASSIGN clause, or other forms of the assignment-name, you must change it to conform to the format supported by Enterprise COBOL.
- B symbol in PICTURE clause: changes in evaluation
- OS/VS COBOL accepted the PICTURE symbols A and B in definitions for
alphabetic items.
Enterprise COBOL accepts only the PICTURE symbol A. (A PICTURE that contains both symbols A and B defines an alphanumeric edited item.)
This change can cause execution differences between OS/VS COBOL and Enterprise COBOL for evaluations of the:- CANCEL statement
- CALL statement
- Class test
- STRING statement
- CALL statement changes
- OS/VS COBOL accepted paragraph
names, section names, and file names in the USING phrase of the CALL statement.
Enterprise COBOL CALL statements do not accept procedure names and accept only QSAM file names in the USING phrase. Therefore, you must remove the procedure names and make sure that file names used in the USING phrase of the CALL statement name QSAM physical sequential files.
To convert OS/VS COBOL programs that call assembler programs and pass procedure names, you need to rewrite the assembler routines. In OS/VS COBOL programs, assembler routines can be written to receive an address or a list of addresses from the paragraph name that was passed as a parameter. The assembler routines can then use this address to return to an alternative place in the main program, if an error occurs.
In Enterprise COBOL, code your assembler routines so that they return to the point of origin with an assigned number. If an error occurs in the assembler program, this number can then be used to go to alternative places in the calling routine.
For example, this assembler routine in OS/VS COBOL is not valid in Enterprise COBOL :CALL "ASMMOD" USING PARAMETER-1, PARAGRAPH-1, PARAGRAPH-2, NEXT STATEMENT. . . . PARAGRAPH-1. . . . PARAGRAPH-2.
The sample code above should be rewritten as shown in the following example in order to compile with Enterprise COBOL:CALL "ASMMOD" USING PARAMETER-1, PARAMETER-2. IF PARAMETER-2 NOT = 0 GOTO PARAGRAPH-1, PARAGRAPH-2, DEPENDING ON PARAMETER-2.
In this example, you would modify the assembler program (ASMMOD) so that it does not branch to an alternative location. Instead, it will pass back the number zero to the calling routine if there are no errors, and a nonzero return value if an error occurred. The nonzero value would be used to determine which paragraph in the COBOL program would handle the error condition.
Many COBOL programmers code assembler programs that use the 390 SPIE mechanism to get control when there is an error or condition. These routines can pass control to a COBOL program at a paragraph whose name was passed to the SPIE routine. Applications that use these user-written SPIE routines should be converted to use Language Environment® condition handling.
- Combined abbreviated relation condition changes
- Three considerations affect combined abbreviated
relation conditions:
- NOT and logical operator/relational operator evaluation
- Parenthesis evaluation
- Optional word IS
All are described in the following sections.
NOT and logical operator/relational operator evaluation: OS/VS COBOL with LANGLVL(1) accepted the use of NOT in combined abbreviated relation conditions as follows:- When only the subject of the relation condition is implied, NOT is considered a logical
operator. For example:
is equivalent to:A = B AND NOT LESS THAN C OR D
((A = B) AND NOT (A < C) OR (A < D))
- When both the subject and the relational operator are implied, NOT is considered to be part of
the relational operator. For example:
is equivalent to:A > B AND NOT C
A > B AND A NOT > C
OS/VS COBOL with LANGLVL(2) and Enterprise COBOL in combined abbreviated relation conditions consider NOT to be:- Part of the relational operator in the forms NOT GREATER THAN, NOT >, NOT LESS THAN, NOT <,
NOT EQUAL TO, and NOT =. For example:
is equivalent to:A = B AND NOT LESS THAN C OR D
((A = B) AND (A NOT < C) OR (A NOT < D))
- NOT in any other position is considered to be a logical operator (and thus results in a negated
relation condition). For example:
is equivalent to:A > B AND NOT C
A > B AND NOT A > C
To ensure that you get the execution results that you want when moving from OS/VS COBOL with LANGLVL(1), you should expand all abbreviated combined conditions to their full unabbreviated forms.
Parenthesis evaluation: OS/VS COBOL accepted the use of parentheses within an abbreviated combined relational condition.
Enterprise COBOL supports most parentheses usage as IBM® extensions. However, there are some 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 accepted by Enterprise COBOL. For example:
(A = 0 AND B) = 0
Optional word IS: OS/VS COBOL accepted the optional word IS immediately preceding objects within an abbreviated combined relation condition. For example:A = B OR IS C AND IS D
Enterprise COBOL does not accept this use of the optional word IS. In Enterprise COBOL, delete the word IS when used in this manner.
Enterprise COBOL does permit the use of the optional word IS as part of the relational operator in abbreviated combined relational conditions. For example:A = B OR IS = C AND IS = D
- COPY statement with associated names
- OS/VS COBOL with LANGLVL(1) allowed COPY
statements to be preceded by an 01-level indicator, which would result in the 01-level name
replacing the 01-level name in the COPY member. For example, with the following contents of COPY
member MBR-A:
01 RECORD-A. 05 FIELD-A... 05 FIELD-B...
and a COPY statement like this:
the resultant source would look like this:01 RECORD1 COPY MBR-A.
01 RECORD1. 05 FIELD-A... 05 FIELD-B...
Enterprise COBOL does not accept this COPY statement. To compile with Enterprise COBOL, use the following statement:01 RECORD1. COPY MBR-A REPLACING ==01 RECORD-A.== BY == ==.
- CURRENCY-SIGN clause changes: '/', '=', and 'L' characters
- OS/VS COBOL with LANGLVL(1), accepted
the '/' (slash) character, the 'L' character, and the '=' (equal) sign in the CURRENCY-SIGN clause.
Enterprise COBOL does not accept these characters as valid.
If these characters are present, you must remove them from the CURRENCY SIGN clause.
- Dynamic CALL statements to ENTRY points
- OS/VS COBOL allowed dynamic CALL statements to alternate entry
points of subprograms without an intervening CANCEL, in some cases.
Enterprise COBOL always requires an intervening CANCEL. When converting these programs, add an intervening CANCEL between dynamic CALL statements referencing alternate ENTRY points of subprograms.
- EXIT PROGRAM/GOBACK statement changes
- In OS/VS
COBOL, when an EXIT PROGRAM or GOBACK statement was executed, if the end of range of a PERFORM
statement within it had not been reached, the PERFORM statement remained in its uncompleted state.
In Enterprise COBOL, when an EXIT PROGRAM or GOBACK statement is executed, the end of range of every PERFORM statement within it is considered to have been reached.
- FILE STATUS clause changes
- In Enterprise COBOL,
status key values have been changed from those received from OS/VS COBOL:
If your OS/VS COBOL program uses status key values to determine the course of execution, you must modify the program to use the new status key values. For complete information about Enterprise COBOL file status codes, see the Enterprise COBOL for z/OS® Language Reference.
Table 1. Status key values: QSAM files OS/VS Enterprise COBOL Meaning (undefined) 04 Wrong length record; successful completion (undefined) 05 Optional file not available; successful completion (undefined) 07 NO REWIND/REEL/UNIT/FOR REMOVAL specified for OPEN or CLOSE, but file not on a reel/unit medium; successful completion 00 00 Successful completion 10 10 At END (no next logical record); successful completion 30 30 Permanent error 34 34 Permanent error file boundary violation 90 90 Other errors with no further information 90 35 Nonoptional file not available 90 37 Device type conflict 90 39 Conflict of fixed file attributes; OPEN fails 90 96 No file identification (no DD statement for the file) 92 38 OPEN attempted for file closed WITH LOCK 92 41 OPEN attempted for a file in OPEN mode 92 42 CLOSE attempted for a file not in OPEN mode 92 43 REWRITE attempted when last I/O statement was not READ 92 44 Attempt to rewrite a sequential file record with a record of a different size 92 46 Sequential READ attempted with no valid next record 92 47 READ attempted when file not in OPEN INPUT or I-O mode 92 48 WRITE attempted when file not in OPEN OUTPUT, I-O, or EXTEND mode 00 48 WRITE attempted when file in OPEN I-O mode 92 49 DELETE or REWRITE attempted when file not in OPEN I-O mode 92 92 Logic error Table 2. Status key values: VSAM files OS/VS Enterprise COBOL Meaning (undefined) 14 On sequential READ for relative file, size of relative record number too large for relative key 00 00 Successful completion 00 04 Wrong length record; successful completion 00 05 Optional file not available; successful completion 00 35 Nonoptional file not available. Can occur when the file is empty. 02 02 Duplicate key, and DUPLICATES specified; successful completion 10 10 At END (no next logical record); successful completion 21 21 Key not valid for a VSAM indexed or relative file; sequence error 22 22 Key not valid for a VSAM indexed or relative file; duplicate key and duplicates not allowed 23 23 Key not valid for a VSAM indexed or relative file; no record found 24 24 Key not valid for a VSAM indexed or relative file; attempt to write beyond file boundaries Enterprise COBOL: for a WRITE to a relative file, size of relative record number too large for relative key
30 30 Permanent error 90 37 Attempt to open a file not on a mass storage device 90 90 Other errors with no further information 91 91 VSAM password failure 92 41 OPEN attempted for a file in OPEN mode 92 42 CLOSE attempted for a file not in OPEN mode 92 43 REWRITE attempted when last I/O statement was not READ or DELETE 92 47 READ attempted when file not in OPEN INPUT or I-O mode 92 48 WRITE attempted when file not in OPEN OUTPUT, I-O, or EXTEND mode 92 49 DELETE or REWRITE attempted when file not in OPEN I-O mode 93 93 VSAM resource not available 93 96 35 Nonoptional file not available 94 46 Sequential READ attempted with no valid next record 95 39 Conflict of fixed file attributes; OPEN fails 95 95 Not valid or incomplete VSAM file information 96 96 No file identification (no DD statement for this VSAM file) 97 97 (when VSAMOPENFS(COMPAT), the default, is in effect) OPEN statement execution successful; file integrity verified 00 (when VSAMOPENFS(SUCC) is in effect) OPEN statement execution successful; file integrity verified - IF . . . OTHERWISE statement changes
- OS/VS COBOL allowed IF statements of the nonstandard format:
IF condition THEN statement-1 OTHERWISE statement-2
Enterprise COBOL allows only IF statements having the standard format:IF condition THEN statement-1 ELSE statement-2
Therefore, OS/VS COBOL programs containing nonstandard IF . . . OTHERWISE statements must be changed to standard IF . . . ELSE statements.
- JUSTIFIED clause changes
- Under OS/VS COBOL with LANGLVL(1), if a JUSTIFIED clause is specified
together with a VALUE clause for a data description entry, the initial data is right-justified. For
example:
results in "FIRST" occupying the five rightmost character positions of DATA-1:77 DATA-1 PIC X(9) JUSTIFIED VALUE "FIRST".
bbbbFIRST
In Enterprise COBOL, the JUSTIFIED clause does not affect the initial placement of the data within the data item. If a VALUE and JUSTIFIED clause are both specified for an alphabetic or alphanumeric item, the initial value is left-justified within the data item. For example:
results in "FIRST" occupying the five leftmost character positions of DATA-1:77 DATA-1 PIC X(9) JUSTIFIED VALUE "FIRST".
FIRSTbbbb
To achieve unchanged results in Enterprise COBOL, you can specify the literal value as occupying all nine character positions of DATA-1. For example:
which right-justifies the value in DATA-1:77 DATA-1 PIC X(9) JUSTIFIED VALUE " FIRST".
bbbbFIRST
- MOVE statements and comparisons: scaling changes
- In OS/VS COBOL with LANGLVL(1), if either the sending field in a MOVE
statement or a field in a comparison is a scaled integer (that is, if the rightmost PICTURE symbols
are the letter P) and the receiving field (or the field to be compared) is alphanumeric or
numeric-edited, the trailing zeros (0) are truncated. For example, after the following MOVE statement is executed:
RECEIVE-FIELD contains the value 123bbb (left-justified), where 'b' represents a blank.05 SEND-FIELD PICTURE 999PPP VALUE 123000. 05 RECEIVE-FIELD PICTURE XXXXXX. . . . MOVE SEND-FIELD TO RECEIVE-FIELD.
With Enterprise COBOL, a MOVE statement transfers the trailing zeros, and a comparison includes them.
For example, after the following MOVE statement is executed:
RECEIVE-FIELD contains the value 123000.05 SEND-FIELD PICTURE 999PPP VALUE 123000. 05 RECEIVE-FIELD PICTURE XXXXXX. . . . MOVE SEND-FIELD TO RECEIVE-FIELD.
- Numeric class test on group items
- OS/VS COBOL allowed the IF NUMERIC class test to be used with group items that contained one or
more signed elementary items. For example,
IF grp1 IS NUMERIC
, whengrp1
is a group item:01 grp1. 03 yy PIC S99. 03 mm PIC S99. 03 dd PIC S99.
Enterprise COBOL issues an S-level message when the IF NUMERIC class test is used for GROUP items whose subordinates are signed.
- Numeric data changes
- Enterprise COBOL uses the NUMPROC compiler
option to alter the code generated for decimal data. While NUMPROC(NOPFD) will cause processing more
similar to OS/VS COBOL than NUMPROC(PFD), results are not the same in all cases. The results of MOVE
statements, comparisons, and arithmetic statements might differ from OS/VS COBOL, particularly when
the fields have not been initialized.
Programs that rely on data exceptions to either identify contents of decimal data items that are not valid or to terminate abnormally might need to be changed to use the class test to validate data in decimal data items.
Since Enterprise COBOL V5.2, you can use the ZONEDATA(MIG) (replaced by INVDATA(FORCENUMCMP) in Enterprise COBOL V6.2 with PTFs for APAR PH31500 installed) to ease your migration to COBOL V5 or V6. When the INVDATA(FORCENUMCMP) option is in effect, the compiler generates instructions to do numeric comparisons that ignore the zone bits of each digit in zoned decimal data items. The compiler will also avoid performing known optimizations that might produce a different result than COBOL V4 when a zoned decimal data item has invalid zone bits. For more information, see INVDATA.
- OCCURS DEPENDING ON clause: ASCENDING and DESCENDING KEY phrase
- OS/VS COBOL accepted a variable-length key in the ASCENDING and DESCENDING KEY phrases of the
OCCURS DEPENDING ON clauses as an IBM extension.
In Enterprise COBOL, you cannot specify a variable-length key in the ASCENDING or DESCENDING KEY phrase.
- OCCURS DEPENDING ON clause: value for receiving items changed
- In OS/VS COBOL, the current value of the OCCURS DEPENDING ON
(ODO) object is always used for both sending and receiving items. In Enterprise COBOL, for sending items, the current value of the ODO object is used. For receiving items:
- If a group item contains both the subject and object of an ODO, and is not followed in the same record by a nonsubordinate data item, the maximum length of the item is used.
- If a group item contains both the subject and object of an ODO and is followed in the same record by a nonsubordinate data item, the actual length of the receiving item is used.
- If a group item contains the subject, but not the object of an ODO, the actual length of the item is used.
When the maximum length is used, it is not necessary to initialize the ODO object before the table receives data. For items whose location depends on the value of the ODO object, you need to set the object of the OCCURS DEPENDING ON clause before using them in the using phrase of a CALL statement. Under Enterprise COBOL, for any variable-length group that is not variably located, you do not need to set the object for the item when it is used in the USING BY REFERENCE phrase of the CALL statement. This is true even if the group is described by the second bullet above.
For example:01 TABLE-GROUP-1 05 ODO-KEY-1 PIC 99. 05 TABLE-1 PIC X(9) OCCURS 1 TO 50 TIMES DEPENDING ON ODO-KEY-1. 01 ANOTHER-GROUP. 05 TABLE-GROUP-2. 10 ODO-KEY-2 PIC 99. 10 TABLE-2 PIC X(9) OCCURS 1 to 50 TIMES DEPENDING ON ODO-KEY-2. 05 VARIABLY-LOCATED-ITEM PIC X(200). . . . PROCEDURE DIVISION. . . . MOVE SEND-ITEM-1 TO TABLE-GROUP-1 . . . MOVE ODO-KEY-X TO ODO-KEY-2 MOVE SEND-ITEM-2 TO TABLE-GROUP-2.
When TABLE-GROUP-1 is a receiving item, Enterprise COBOL moves the maximum number of character positions for it (450 bytes for TABLE-1 plus two bytes for ODO-KEY-1). Therefore, you need not initialize the length of TABLE-1 before moving the SEND-ITEM-1 data into the table.
However, a nonsubordinate VARIABLY-LOCATED-ITEM follows TABLE-GROUP-2 in the record description. In this case, Enterprise COBOL uses the actual value in ODO-KEY-2 to calculate the length of TABLE-GROUP-2, and you must set ODO-KEY-2 to its valid current length before moving the SEND-ITEM-2 data into the group receiving item.
- ON SIZE ERROR phrase: changes in intermediate results
- For OS/VS COBOL, the SIZE ERROR phrase for the DIVIDE and MULTIPLY statements
applied to both intermediate and final results.
For Enterprise COBOL, the SIZE ERROR phrase for the DIVIDE and MULTIPLY statements applies only to final results. This is a change between the 74 COBOL Standard and the 85 COBOL Standard. This change might or might not affect your programs.
Therefore, if your OS/VS COBOL program depends upon SIZE ERROR detection for intermediate results, you might need to change it.
- Optional word IS
- For OS/VS COBOL programs, no
MIGR message would be issued if the optional word IS immediately preceded objects within an
abbreviated combined relation condition. For example:
A = B OR IS C AND IS D
Enterprise COBOL does not accept this use of the optional word IS. In Enterprise COBOL, delete the word IS when used in this manner.
Enterprise COBOL does permit the use of the optional word IS as part of the relational operator in abbreviated combined relational conditions. For example:A = B OR IS = C AND IS = D
- PERFORM statement: changes in the VARYING/AFTER phrases
- In OS/VS COBOL, in a PERFORM
statement with the VARYING/AFTER phrases, two actions take place when an inner condition tests as
TRUE:
- The identifier/index associated with the inner condition is set to its current FROM value.
- The identifier/index associated with the outer condition is augmented by its current BY value.
In Enterprise COBOL in such a PERFORM statement, the following results take place when an inner condition tests as TRUE:
- The identifier/index associated with the outer condition is augmented by its current BY value.
- The identifier/index associated with the inner condition is set to its current FROM value.
The following example illustrates the differences in results:PERFORM ABC VARYING X FROM 1 BY 1 UNTIL X > 3 AFTER Y FROM X BY 1 UNTIL Y > 3
In OS/VS COBOL, ABC is executed 8 times with the following values:X: 1 1 1 2 2 2 3 3 Y: 1 2 3 1 2 3 2 3
In Enterprise COBOL, ABC is executed 6 times with the following values:X: 1 1 1 2 2 3 Y: 1 2 3 2 3 3
By using nested PERFORM statements, you could achieve the same processing results as in OS/VS COBOL, as follows:MOVE 1 TO X, Y, Z PERFORM EX-1 VARYING X FROM 1 BY 1 UNTIL X > 3 . . . EX-1. PERFORM ABC VARYING Y FROM Z BY 1 UNTIL Y > 3. MOVE X TO Z. ABC.
- PROGRAM COLLATING SEQUENCE clause changes
- In OS/VS COBOL, the collating sequence specified in the
alphabet-name of the PROGRAM COLLATING SEQUENCE clause is applied to comparisons
implicitly performed during execution of INSPECT, STRING, and UNSTRING statements.
In Enterprise COBOL, the collating sequence specified in alphabet-name is not used for these implicit comparisons.
- READ and RETURN statement changes: INTO phrase
- When the sending field is chosen for the move associated with a READ or RETURN . . . INTO identifier statement, OS/VS COBOL and Enterprise COBOL can select different records from under the FD or SD to use as the sending field. This only affects implicit elementary MOVE statements, when the record description has a PICTURE clause.
- RERUN clause changes
- When the RERUN clause is specified, OS/VS COBOL takes a checkpoint on the first record; Enterprise COBOL does not.
- RESERVE clause changes
- OS/VS COBOL supported the following formats of the FILE CONTROL
paragraph RESERVE clause:
RESERVE NO ALTERNATE AREA RESERVE NO ALTERNATE AREAS RESERVE integer ALTERNATE AREA RESERVE integer ALTERNATE AREAS RESERVE integer AREA RESERVE integer AREAS
Enterprise COBOL supports only the following forms of the RESERVE clause:RESERVE integer AREA RESERVE integer AREAS
If your OS/VS COBOL program uses either the RESERVE integer ALTERNATE AREA or the RESERVE integer ALTERNATE AREAS format, you must specify the RESERVE clause with integer + 1 areas to get equivalent processing under Enterprise COBOL. That is, the OS/VS COBOL phrase
RESERVE 2 ALTERNATE AREAS
is equivalent toRESERVE 3 AREASA
in Enterprise COBOL.Under OS/VS COBOL with LANGLVL(1), the interpretation of the RESERVE integer AREAS format differed from the interpretation of this format using Enterprise COBOL.
With LANGLVL(1), using the RESERVE integer AREA or RESERVE integer AREAS format, you must specify the RESERVE clause with integer + 1 areas to get equivalent processing under Enterprise COBOL.
- Reserved word list changes
- Differences exist between the reserved word list for Enterprise COBOL and OS/VS COBOL. COBOL reserved word comparison contains a complete listing of reserved words.
- SEARCH statement changes
- In OS/VS COBOL, the ASCENDING and DESCENDING KEY data items could be
specified either as the subject or as the object of the WHEN relation-condition of the SEARCH
statement.
In Enterprise COBOL, the WHEN phrase data-name (the subject of the WHEN relation-condition) must be an ASCENDING or a DESCENDING KEY data item in this table element, and identifier-2 (the object of the WHEN relation-condition) must not be an ASCENDING or DESCENDING key data item for this table element.
OS/VS COBOL accepted the following statement; Enterprise COBOL does not:WHEN VAL = KEY-1 ( INDEX-NAME-1 ) DISPLAY "TABLE RECORDS OK".
The following SEARCH example will execute under both Enterprise COBOL and OS/VS COBOL:01 VAL PIC X. 01 TABLE-01. 05 TABLE-ENTRY OCCURS 100 TIMES ASCENDING KEY IS KEY-1 INDEXED BY INDEX-NAME-1. 10 FILLER PIC X. 10 KEY-1 PIC X. SEARCH ALL TABLE-ENTRY AT END DISPLAY "ERROR" WHEN KEY-1 ( INDEX-NAME-1 ) = VAL DISPLAY "TABLE RECORDS OK".
- Segmentation changes: PERFORM statement in independent segments
- In OS/VS COBOL with LANGLVL(1), if a PERFORM statement in an
independent segment refers to a permanent segment, the independent segment is initialized upon each
exit from the performed procedures.
In OS/VS COBOL with LANGLVL(2), for a PERFORM statement in an independent segment that refers to a permanent segment, control is passed to the performed procedures only once for each execution of the PERFORM statement.
In Enterprise COBOL, the compiler does not perform overlay; therefore, the rules given above do not apply.
If your program logic depends upon either of the OS/VS COBOL implementations of these segmentation rules, you must rewrite the program.
- SELECT OPTIONAL clause changes
- In OS/VS COBOL with LANGLVL(1), if the SELECT OPTIONAL clause is specified in the file control entry, the program will fail if the file is not available. In Enterprise COBOL, if the SELECT OPTIONAL clause is specified in the file control entry, the program will not fail if the file is not available and a file status code of 05 is returned. A USERMOD can influence this behavior for VSAM. For details, see: Language Environment Installation and Customization.
- SORT special registers
- The SORT-CORE-SIZE, SORT-FILE-SIZE, SORT-MESSAGE, and
SORT-MODE-SIZE special registers are supported under Enterprise COBOL, and they will be used in the SORT interface when they
have nondefault values. However, at run time, individual SORT special registers will be overridden
by the corresponding parameters on control statements that are included in the SORT-CONTROL file,
and a message will be issued. In addition, a compiler warning message (W-level) will be issued for
each SORT special register that was set in the program.
In OS/VS COBOL, the SORT-RETURN special register can contain codes for successful SORT completion (RC=0), OPEN or I/O errors concerning the USING or GIVING files (RC=2 through RC=12), and unsuccessful SORT completion (RC=16). In Enterprise COBOL, the SORT-RETURN register only contains codes for successful (RC=0) and unsuccessful (RC=16) SORT completion.
- Source language debugging changes
- With Enterprise COBOL and
OS/VS COBOL, you can debug source language with the USE FOR DEBUGGING declarative. Valid operands
are shown in Table 3. Operands that are not valid in Enterprise COBOL must be removed from the OS/VS COBOL program. Use
Debug Tool to achieve the same debugging results.
Table 3. USE FOR DEBUGGING declarative: valid operands Debugging operands Procedures are executed immediately: OS/VS COBOL Enterprise COBOL procedure-name-1 procedure-name-1 Before each execution of the named procedure. After execution of an ALTER statement referring to the named procedure.
ALL PROCEDURES ALL PROCEDURES Before execution of every nondebugging procedure in the outermost program After execution of every ALTER statement in the outermost program (except ALTER statements in declarative procedures).
file-name-n (none) See the IBM VS COBOL for OS/VS for a description. ALL REFERENCES OF identifier-n (none) See the IBM VS COBOL for OS/VS for a description. cd-name-1 (none) See the IBM VS COBOL for OS/VS for a description. - Subscripts out of range flagged at compile time
- Enterprise COBOL issues an error
(RC = 8) message if a literal subscript or index value is coded that is greater than the allowed
maximum, or less than one. This message is generated whether or not the SSRANGE option is specified.
OS/VS COBOL did not issue an equivalent error message.
- UNSTRING statements: subscript evaluation changes
- In the UNSTRING statements for OS/VS COBOL, any associated
subscripting, indexing, or length calculation would be evaluated immediately before the transfer of
data into the receiving item for the DELIMITED BY, INTO, DELIMITER IN, and COUNT IN fields. For these fields, in the Enterprise COBOL UNSTRING statement, any associated subscripting, indexing, or length calculation is evaluated once: immediately before the examination of the delimiter sending fields. For example:
01 ABC PIC X(30). 01 IND. 02 IND-1 PIC 9. 01 TAB. 02 TAB-1 PIC X OCCURS 10 TIMES. 01 ZZ PIC X(30). . . . UNSTRING ABC DELIMITED BY TAB-1 (IND-1) INTO IND ZZ.
In OS/VS COBOL, subscript IND-1 would be reevaluated before the second receiver ZZ was filled.
In Enterprise COBOL, the subscript IND-1 is evaluated only once at the beginning of the execution of the UNSTRING statement.
In OS/VS COBOL with LANGLVL(1), when the DELIMITED BY ALL phrase of UNSTRING is specified, two or more contiguous occurrences of any delimiter are treated as if they were only one occurrence. As much of the first occurrence as will fit is moved into the current delimiter receiving field (if specified). Each additional occurrence is moved only if the complete occurrence will fit. For more information about the behavior of this phrase in OS/VS COBOL, see the IBM VS COBOL for OS/VS.
In Enterprise COBOL, one or more contiguous occurrences of any delimiters are treated as if they are only one occurrence, and this one occurrence is moved to the delimiter receiving field (if specified).
For example, if ID-SEND contains 123**45678**90AB:UNSTRING ID-SEND DELIMITED BY ALL "*" INTO ID-R1 DELIMITER IN ID-D1 COUNT IN ID-C1 ID-R2 DELIMITER IN ID-D2 COUNT IN ID-C2 ID-R3 DELIMITER IN ID-D3 COUNT IN ID-C3
OS/VS COBOL with LANGLVL(1), will produce this result:ID-R1 123 1D-D1 ** ID-C1 3 ID-R2 45678 1D-D2 ** ID-C2 5 ID-R3 90AB 1D-D3 ID-C3 4
OS/VS COBOL with LANGLVL(2) and Enterprise COBOL will produce this result:ID-R1 123 1D-D1 * ID-C1 3 ID-R2 45678 1D-D2 * ID-C2 5 ID-R3 90AB 1D-D3 ID-C3 4
- UPSI switches
- OS/VS COBOL allowed references to UPSI switches and mnemonic
names associated with UPSI. Enterprise COBOL allows
condition-names only.
For example, if a condition-name is defined in the SPECIAL-NAMES paragraph, the following code examples have the same effect:
OS/VS COBOL Enterprise COBOL SPECIAL-NAMES. SPECIAL-NAMES. UPSI-0 IS MNUPO UPSI-0 IS MNUPO ON STATUS IS UPSI-0-ON OFF STATUS IS UPSI-0-OFF . . . . . . PROCEDURE DIVISION PROCEDURE DIVISION . . . . . . IF UPSI-0 = 1 ... IF UPSI-0-ON ... IF MNUPO = 0 ... IF UPSI-0-OFF ...
- VALUE clause condition names
- For VALUE clause condition names,
releases prior to Release 2.4 of OS/VS COBOL allowed the initialization of an alphanumeric field
with a numeric value. For example:
01 FIELD-A. 02 LAST-YEAR PIC XX VALUE 87. 02 THIS-YEAR PIC XX VALUE 88. 02 NEXT-YEAR PIC XX VALUE 89.
Enterprise COBOL does not accept this language extension. Therefore, to correct the above example, you should code alphanumeric values in the VALUE clauses, as in the following example:01 FIELD-A. 02 LAST-YEAR PIC XX VALUE "87". 02 THIS-YEAR PIC XX VALUE "88". 02 NEXT-YEAR PIC XX VALUE "89".
- WHEN-COMPILED special register
- Enterprise COBOL and OS/VS COBOL support the use of the WHEN-COMPILED
special register. The rules for use of the special register are the same for both compilers.
However, the format of the data differs. In OS/VS COBOL the format is:
hh.mm.ssMMM DD, YYYY (hour.minute.secondMONTH DAY, YEAR)
In Enterprise COBOL the format is:MM/DD/YYhh.mm.ss (MONTH/DAY/YEARhour.minute.second)
- WRITE AFTER POSITIONING statement
- OS/VS COBOL supported the WRITE statement with the AFTER
POSITIONING phrase; Enterprise COBOL does not.
In Enterprise COBOL, you can use the WRITE . . . AFTER ADVANCING statement to obtain behavior similar to WRITE . . . AFTER POSITIONING. The following two examples show OS/VS COBOL POSITIONING phrases and the equivalent Enterprise COBOL phrases.
When using WRITE . . . AFTER ADVANCING with literals:OS/VS COBOL Enterprise COBOL AFTER POSITIONING 0 AFTER ADVANCING PAGE AFTER POSITIONING 1 AFTER ADVANCING 1 LINE AFTER POSITIONING 2 AFTER ADVANCING 2 LINES AFTER POSITIONING 3 AFTER ADVANCING 3 LINES
When using WRITE...AFTER ADVANCING with nonliterals:WRITE OUTPUT-REC AFTER POSITIONING SKIP-CC. OS/VS COBOL Enterprise COBOL SKIP-CC AFTER POSITIONING SKIP-CC 1 AFTER ADVANCING PAGE AFTER POSITIONING SKIP-CC ' ' AFTER ADVANCING 1 LINE AFTER POSITIONING SKIP-CC 0 AFTER ADVANCING 2 LINES AFTER POSITIONING SKIP-CC - AFTER ADVANCING 3 LINES
Restriction: With Enterprise COBOL, channel skipping is only supported with references to SPECIAL-NAMES.CCCA can automatically convert WRITE . . . AFTER POSITIONING statements. For example, given the following statement:WRITE OUTPUT-REC AFTER POSITIONING n.
If n is a literal, CCCA would change the above example to
WRITE...AFTER ADVANCING n LINES
. If n is an identifier, SPECIAL-NAMES are generated and a section is added at the end of the program.