Upgrading programs compiled with the CMPR2 compiler option

Beginning with VS COBOL II Release 3.0, you could choose the 85 COBOL Standard behavior (without the Intrinsic Function module) by using NOCMPR2, or the 74 COBOL Standard behavior by using the CMPR2 compiler option. But with Enterprise COBOL, programs must be at the 85 COBOL Standard level.

The CMPR2 option provided the Standard COBOL 74 behavior as implemented by VS COBOL II Release 2, as well as nonstandard Release 2 extensions now implemented in 85 COBOL Standard. The NOCMPR2 option provided 85 COBOL Standard-conforming behavior and IBM® extensions. This same mechanism was provided by IBM COBOL as an aid to allow delaying the upgrade from VS COBOL II Release 2 level code to 85 COBOL Standard level code. In Enterprise COBOL, this delay is not available.

Enterprise COBOL provides 85 COBOL Standard support whereas VS COBOL II Release 2, provided the 74 COBOL Standard support (with some 85 COBOL Standard features added in). The implementation of 85 COBOL Standard caused some language elements to behave in a manner that differs from the implementation of 74 COBOL Standard.

When referring to VS COBOL II Release 3 or later and IBM COBOL, the following terms have been defined:
CMPR2
We use CMPR2 to refer to the language and behavior of programs compiled and run with:
  • VS COBOL II Release 2
  • VS COBOL II, Release 3 or 4 with the CMPR2 compiler option
  • IBM COBOL with the CMPR2 compiler option.
NOCMPR2
We use NOCMPR2 to refer to the language and behavior of programs compiled and run with:
  • VS COBOL II, Release 3 or 4, with the NOCMPR2 compiler option
  • IBM COBOL with the NOCMPR2 compiler option
  • Enterprise COBOL
FLAGMIG
We use FLAGMIG to refer to the use of a pre-Enterprise COBOL compiler (VS COBOL II or IBM COBOL) that supports the CMPR2 and FLAGMIG options.
Tip: To aid you with migration to Enterprise COBOL, use a previous COBOL compiler that supports FLAGMIG and CMPR2 to flag the statements that need to be converted.

The language elements listed below are affected by the CMPR2/NOCMPR2 compiler option. The differences are explained in the sections that follow.

Table 1. Language elements different between CMPR2 and NOCMPR2
Language element Page
ALPHABET clause of the SPECIAL-NAMES paragraph ALPHABET clause of the SPECIAL-NAMES paragraph
ALPHABETIC class ALPHABETIC class
CALL ... ON OVERFLOW CALL . . . ON OVERFLOW
Comparisons between scaled integers and nonnumerics Comparisons between scaled integers and nonnumerics
COPY...REPLACING statements using non-COBOL characters COPY ... REPLACING statements using non-COBOL characters
COPY statement using national extension characters COPY statement using national extension characters
File status codes File status codes
Fixed filed attributes and DCB= parameters of JCL Fixed-file attributes and DCB= parameters of JCL
Implicit EXIT PROGRAM Implicit EXIT PROGRAM
OPEN statement failing for QSAM file (FILE STATUS 39) OPEN statement failing for QSAM files (FILE STATUS 39)
OPEN statement failing for VSAM files (FILE STATUS 39) OPEN statement failing for VSAM files (FILE STATUS 39)
PERFORM return mechanism PERFORM return mechanism
PERFORM...VARYING...AFTER PERFORM ... VARYING ... AFTER
PICTURE clause with "A"s and "B"s PICTURE clause with "A"s and "B"s
PROGRAM COLLATING SEQUENCE PROGRAM COLLATING SEQUENCE
READ INTO and RETURN INTO READ INTO and RETURN INTO
RECORD CONTAINS n CHARACTERS RECORD CONTAINS n CHARACTERS
SET...TO TRUE SET . . . TO TRUE
SIZE ERROR on MULTIPLY and DIVIDE SIZE ERROR on MULTIPLY and DIVIDE
UNSTRING operand evaluation UNSTRING operand evaluation
UPSI switches UPSI switches
Variable-length group moves Variable-length group moves