Microsoft KB Archive/44235

From BetaArchive Wiki

COBOL 3.0a; DISPLAY Incorrect If LINE/COLUMN Before Data Item

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

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

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

Summary: The Microsoft COBOL version 3.0a DISPLAY statement produces incorrect results if the LINE and COLUMN clauses appear prior to the data item being displayed. If this undocumented format is used, the compiler ignores the LINE and COLUMN clauses and also fails to insert a carriage return between DISPLAYed lines. The result is that the data items are displayed starting at LINE 1 COLUMN 1 and strung together, wrapping around on the screen. Microsoft has confirmed this to be a problem in version 3.0a. This problem has been corrected in Microsoft COBOL Professional Development System version 4.0. This problem does not occur in version 3.0 of the Microsoft COBOL Compiler.

More Information: Both of the following syntax descriptions demonstrate the problem: DISPLAY LINE <integer-1> COLUMN <integer-2> <identifier-to-display>. DISPLAY AT <integer-3> <identifier-to-display>.

Code Example

  ******************************************************
  *                  PROG1.COB                         *
  * This program shows the incorrect syntax and results.
   PROCEDURE DIVISION.
     display at 0115 "This program does not work".
     display at 0315 "This program does not work".
     display at 1015 "This program does not work".
     display line 13 col 15 "This program does not work".
     display line 15 col 15 "This program does not work".
     display line 17 col 15 "This program does not work".
     display line 20 col 15 "This program does not work".
   STOP RUN.
  ******************************************************
  *                  PROG2.COB                         *
  * This program also shows the correct syntax and results.
   PROCEDURE DIVISION.
     display "This program works" line 01 col 15.
     display "This program works" line 03 col 15.
     display "This program works" line 10 col 15.
     display "This program works" at 1315.
     display "This program works" at 1515.
     display "This program works" at 1715.
     display "This program works" at 2015.
   STOP RUN.

Additional reference words: 3.00a Copyright Microsoft Corporation 1993.