Microsoft KB Archive/58818

From BetaArchive Wiki

EXHIBIT and EXHIBIT CHANGED Fail in COBOL 3.0, 3.0a

PSS ID Number: Q58818 Article last modified on 04-20-1993

3.00 3.00a | 3.00 3.00a MS-DOS | OS/2

The information in this article applies to:
- Microsoft COBOL for MS-DOS and OS/2, versions 3.0 and 3.0a

Summary: The EXHIBIT and EXHIBIT CHANGED statements of Microsoft COBOL Compiler Versions 3.0 and 3.0a for MS-DOS and MS OS/2 do not work correctly. Both of these statements display only the values of the identifiers specified after them and do not include the names of those identifiers. This behavior is contrary to that which is specified in the documentation. As a workaround, use EXHIBIT NAMED in place of EXHIBIT and EXHIBIT CHANGED NAMED in place of EXHIBIT CHANGED.

More Information: Page 3-112 of the “Microsoft COBOL Compiler 3.0: Language Reference Manual” states the following: [1.] Each execution of an EXHIBIT NAMED statement displays each identifier or literal specified, with each identifier (including any qualifiers and subscripts) followed by an “=” (equal sign) and its current value. [2.] Each execution of an EXHIBIT CHANGED statement displays each identifier or literal specified, with each identifier (including any qualifiers and subscripts) followed by an “=” (equal sign) and its current value. While discussing the syntax of the EXHIBIT statement on the previous page (3-111) the manual states the following: [3.] CHANGED and NAMED may both be omitted. The effect is as if NAMED were specified. Items 2 and 3 (above) are false. The EXHIBIT and EXHIBIT CHANGED statements do not display the same output as EXHIBIT NAMED. The EXHIBIT NAMED statement outputs a line in the following format: <identifier> = <value> Here, <identifier> is the name of the identifier in the COBOL source and <value> is the value of that identifier when the EXHIBIT NAMED statement was executed. The EXHIBIT and EXHIBIT CHANGED statements do not include the name of the identifier and output in the following format: <value> The following sample program illustrates the behavior of EXHIBIT NAMED: * Compile with /OSVS directive. DATA DIVISION. WORKING-STORAGE SECTION. 01 DATA-NAME PIC 99. PROCEDURE DIVISION. EXHIBIT NAMED DATA-NAME. STOP RUN. The above program produces the following output: DATA-NAME = 10 The next sample program demonstrates the behavior (incorrect) of EXHIBIT and EXHIBIT CHANGED: * Compile with /OSVS directive. DATA DIVISION. WORKING-STORAGE SECTION. 01 DATA-NAME PIC 99. PROCEDURE DIVISION. EXHIBIT DATA-NAME. EXHIBIT CHANGED DATA-NAME. STOP RUN. The above program produces the following output: 10 10 To work around the problem, use EXHIBIT NAMED in place of EXHIBIT and EXHIBIT CHANGED NAMED in place of EXHIBIT CHANGED. The following program example is the corrected version of the above example: * Compile with /OSVS directive. DATA DIVISION. WORKING-STORAGE SECTION. 01 DATA-NAME PIC 99. PROCEDURE DIVISION. EXHIBIT DATA-NAME. EXHIBIT CHANGED DATA-NAME. STOP RUN. The above program produces the following output: DATA-NAME = 10 DATA-NAME = 10

Additional reference words: 3.00 3.00a Copyright Microsoft Corporation 1993.