The following OS/VS COBOL language elements are changed in Enterprise COBOL in order to conform to the COBOL 85 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 (semantics have changed).
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.
In Enterprise COBOL, the ALPHABET keyword is required.
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 TO assignment-nameWhere assignment-name can have the following forms:
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.
Enterprise COBOL accepts only the PICTURE symbol A. (A PICTURE that contains both symbols A and B defines an alphanumeric edited item.)
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.
CALL "ASMMOD" USING PARAMETER-1,
PARAGRAPH-1,
PARAGRAPH-2,
NEXT STATEMENT.
. . .
PARAGRAPH-1.
. . .
PARAGRAPH-2.
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.
All are described in the following sections.
A = B AND NOT LESS THAN C OR Dis equivalent to:
((A = B) AND NOT (A < C) OR (A < D))
A > B AND NOT Cis equivalent to:
A > B AND A NOT > C
A = B AND NOT LESS THAN C OR Dis equivalent to:
((A = B) AND (A NOT < C) OR (A NOT < D))
A > B AND NOT Cis equivalent to:
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.
A = B AND ( < C OR D)
(A = 0 AND B) = 0
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.
A = B OR IS = C AND IS = D
01 RECORD-A. 05 FIELD-A... 05 FIELD-B...
01 RECORD1 COPY MBR-A.the resultant source would look like this:
01 RECORD1.
05 FIELD-A...
05 FIELD-B...
01 RECORD1.
COPY MBR-A REPLACING ==01 RECORD-A== BY == ==.
Enterprise COBOL does not accept these characters as valid. In addition, Enterprise COBOL does not accept the character G for programs that use DBCS data items.
If these characters are present, you must remove them from the CURRENCY SIGN clause.
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.
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.
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 on Enterprise COBOL file status codes, see the Enterprise COBOL Language Reference Manual.
| 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 |
| 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 | OPEN statement execution successful; file integrity verified |
IF condition THEN statement-1 OTHERWISE statement-2
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.
77 DATA-1 PIC X(9) JUSTIFIED VALUE "FIRST".results in "FIRST" occupying the five rightmost character positions of DATA-1:
bbbbFIRST
77 DATA-1 PIC X(9) JUSTIFIED VALUE "FIRST".results in "FIRST" occupying the five leftmost character positions of DATA-1:
FIRSTbbbb
77 DATA-1 PIC X(9) JUSTIFIED VALUE " FIRST".which right-justifies the value in DATA-1:
bbbbFIRST
05 SEND-FIELD PICTURE 999PPP VALUE 123000.
05 RECEIVE-FIELD PICTURE XXXXXX.
. . .
MOVE SEND-FIELD TO RECEIVE-FIELD.
RECEIVE-FIELD contains the value 123bbb (left-justified), where 'b'
represents a blank.With Enterprise COBOL, a MOVE statement transfers the trailing zeros, and a comparison includes them.
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.
For example, Enterprise COBOL will not generate a negative zero result, while OS/VS COBOL could. In addition, Enterprise COBOL will not repair invalid signs on input with NUMPROC(MIG), while OS/VS COBOL programs did inconsistent sign repair on input.
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.
In Enterprise COBOL, you cannot specify a variable-length key in the ASCENDING or DESCENDING KEY phrase.
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.
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.
For Enterprise COBOL, the SIZE ERROR phrase for the DIVIDE and MULTIPLY statements applies only to final results. This is a change between the COBOL 74 Standard and the COBOL 85 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.
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.
A = B OR IS = C AND IS = D
In Enterprise COBOL in such a PERFORM statement, the following takes place when an inner condition tests as TRUE:
PERFORM ABC VARYING X FROM 1 BY 1 UNTIL X > 3
AFTER Y FROM X BY 1 UNTIL Y > 3
X: 1 1 1 2 2 2 3 3 Y: 1 2 3 1 2 3 2 3
X: 1 1 1 2 2 3 Y: 1 2 3 2 3 3
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.
In Enterprise COBOL, the collating sequence specified in alphabet-name is not used for these implicit comparisons.
RESERVE NO ALTERNATE AREA RESERVE NO ALTERNATE AREAS RESERVE integer ALTERNATE AREA RESERVE integer ALTERNATE AREAS RESERVE integer AREA RESERVE integer AREAS
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 to RESERVE 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.
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.
WHEN VAL = KEY-1 ( INDEX-NAME-1 ) DISPLAY "TABLE RECORDS OK".
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".
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.
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.
| 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 IBM VS COBOL for OS/VS for a description. |
| ALL REFERENCES OF identifier-n | (none) | See IBM VS COBOL for OS/VS for a description. |
| cd-name-1 | (none) | See IBM VS COBOL for OS/VS for a description. |
OS/VS COBOL did not issue an equivalent error message.
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 on the behavior of this phrase in OS/VS COBOL, see 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).
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
ID-R1 123 1D-D1 ** ID-C1 3 ID-R2 45678 1D-D2 ** ID-C2 5 ID-R3 90AB 1D-D3 ID-C3 4
ID-R1 123 1D-D1 * ID-C1 3 ID-R2 45678 1D-D2 * ID-C2 5 ID-R3 90AB 1D-D3 ID-C3 4
For example, if a condition-name is defined in the SPECIAL-NAMES paragraph, the following are equivalent:
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 ...
01 FIELD-A.
02 LAST-YEAR PIC XX VALUE 87.
02 THIS-YEAR PIC XX VALUE 88.
02 NEXT-YEAR PIC XX VALUE 89.
01 FIELD-A.
02 LAST-YEAR PIC XX VALUE "87".
02 THIS-YEAR PIC XX VALUE "88".
02 NEXT-YEAR PIC XX VALUE "89".
hh.mm.ssMMM DD, YYYY (hour.minute.secondMONTH DAY, YEAR)
MM/DD/YYhh.mm.ss (MONTH/DAY/YEARhour.minute.second)
In Enterprise COBOL, you can use the WRITE . . . AFTER ADVANCING statement to receive behavior similar to WRITE . . . AFTER POSITIONING. The following two examples show OS/VS COBOL POSITIONING phrases and the equivalent Enterprise COBOL phrases.
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
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
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.