Microsoft KB Archive/46982

COBOL 3.0 Can’t Set FOREGROUND-COLOR to HIGHLIGHT Permanently

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

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

Summary: In Microsoft COBOL Versions 3.0 and 3.0a, the permanent FOREGROUND-COLOR can only be set with color values from 0 through 6. The FOREGROUND-COLOR cannot be set permanently with HIGHLIGHT. The HIGHLIGHT clause is in effect only for the DISPLAY in which it is used. Note: The HIGHLIGHT clause has no effect on the BACKGROUND-COLOR.

More Information: The following code fragments demonstrate the use of HIGHLIGHT. For the DISPLAYs for a given program to all have a FOREGROUND-COLOR of brown, the program would first DISPLAY the following screen, where the color value of 6 will display as brown: 01 screen-1 foreground-colour 6. 05 blank screen. 05 line 01 column 10 value “SCREEN #1”. Now, consider the another SCREEN SECTION entry: 01 screen-1 highlight foreground-colour 6. 05 blank screen. 05 line 01 column 10 value “SCREEN #1”. This SCREEN will DISPLAY its items as yellow, where yellow is the high-intensity color of brown. After DISPLAYing this SCREEN, any subsequent SCREENs with no HIGHLIGHT clause will DISPLAY their items as brown. For other SCREENs or PROCEDURE DIVISION DISPLAYs to DISPLAY their items as yellow, they must specifically include the HIGHLIGHT clause. Otherwise, they would DISPLAY as brown, color value 6, with no HIGHLIGHT.

Code Example
The following is a code sample that demonstrates the use of the HIGHLIGHT and FOREGROUND-COLOR clauses: * Compile line * > COBOL highli.cob * Link line * LINK highli.obj; WORKING-STORAGE SECTION. 77 PAUSE-VAR PIC X. SCREEN SECTION. 01 SCREEN-1 HIGHLIGHT FOREGROUND-COLOUR 6 BACKGROUND-COLOR 1. 05 BLANK SCREEN. 05 LINE 01 COLUMN 10 VALUE “SCREEN #1”. 05 LINE 02 COLUMN 10 VALUE “THIS WILL DISPLAY WITH HIGHLIGHTED FOREGROUND COLOR”. 01 SCREEN-2. 05 LINE 05 COLUMN 10 VALUE “SCREEN #2”. 05 LINE 06 COLUMN 10 VALUE “THIS SCREEN WILL DISPLAY WITH THE FOREGROUND COLOR”. 05 LINE 07 COLUMN 10 VALUE “ESTABLISHED IN SCREEN-1, BUT WITHOUT THE HIGHLIGHT”. 01 WAIT-SCREEN AUTO. 05 LINE 25 COLUMN 1 VALUE “HIT ANY KEY TO CONTINUE…..”. 05 LINE 25 COLUMN 80 PIC X USING PAUSE-VAR. PROCEDURE DIVISION. * THIS SCREEN WILL DISPLAY WITH HIGHLIGHTED FOREGROUND COLOR DISPLAY SCREEN-1. * THIS SCREEN WILL DISPLAY WITH THE FOREGROUND COLOR * ESTABLISHED IN SCREEN-1, BUT WITHOUT THE HIGHLIGHT. DISPLAY SCREEN-2. * THIS WILL ALSO DISPLAY WITH THE FOREGROUND COLOR * ESTABLISHED IN SCREEN-1, BUT WITHOUT THE HIGHLIGHT. DISPLAY “PROCEDURE DIVISION DISPLAY” AT 1510. * THIS WILL DISPLAY WITH THE FOREGROUND COLOR * ESTABLISHED IN SCREEN-1, BUT WITH THE HIGHLIGHT. DISPLAY “PROCEDURE DIVISION DISPLAY WITH HIGHLIGHT” WITH HIGHLIGHT AT 1610. DISPLAY “PROCEDURE DIVISION DISPLAY WITH NO HIGHLIGHT” AT 1710. DISPLAY WAIT-SCREEN. ACCEPT WAIT-SCREEN. STOP RUN.

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