Microsoft KB Archive/34289

Setting Default Colors Differs between COBOL 2.2 and 3.0

PSS ID Number: Q34289 Article last modified on 04-21-1993

3.00 | 3.00 MS-DOS | OS/2

Summary: In COBOL Version 2.2, it is possible to set the background and foreground colors once in the SCREEN SECTION and thereafter have the defaults be those colors. The Microsoft 2 compatibility option in ADISCF in COBOL Version 3.0 is incorrectly set to use a black background as the default rather than the colors defined by the first DISPLAYed screen. There are two workarounds for this problem, as follows: 1. Alter ADISCTRL using ADISCF. 2. Rewrite the code as in the sample below.

More Information: Workaround 1 The default can easily be changed by invoking ADISCF, as follows: 1. Press F2 (the ALTER option). 2. Press F3 (the ACCEPT AND DISPLAY option). 3. Press F3 (INDIVIDUAL OPTIONS). 4. Press F2 (the NEXT PAGE option). 5. Press 1 (the IF NO COLOUR IS SPECIFIED THE CURRENT DEFAULT SCREEN COLOUR IS USED option). 6. Press ESC to exit the screen. 7. Press F4 (the SAVE option) to save the configuration. 8. Press ESC to exit the screen. The resulting ADISCTRL file will need to be distributed with the program since ADIS will read the entries in the file at run time. Workaround 2 Program 1 below works under COBOL Version 2.2, but produces “holes” of white characters on a black background in COBOL Version 3.0. Program 2 works correctly under COBOL Version 3.0. Please note that the rest of the screen is subordinate to the color settings in Program 2. The following are code examples: * PROGRAM 1 IDENTIFICATION DIVISION. PROGRAM-ID. SETCOLOR. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. SCREEN SECTION. 01 COLOR-SCREEN. 02 BLANK SCREEN FOREGROUND-COLOR 3 BACKGROUND-COLOR 5. 01 TEST-SCREEN. 02 LINE 2 COLUMN 10 VALUE “HELLO”. PROCEDURE DIVISION. ONLY-PARA. DISPLAY COLOR-SCREEN. DISPLAY TEST-SCREEN. STOP RUN. ——————————————————- * PROGRAM 2 IDENTIFICATION DIVISION. PROGRAM-ID. SETCOLOR. ENVIRONMENT DIVISION. DATA DIVISION. WORKING-STORAGE SECTION. SCREEN SECTION. 01 COLOR-SCREEN. 02 BLANK SCREEN FOREGROUND-COLOR 3 BACKGROUND-COLOR 5. 01 TEST-SCREEN. 02 COLOR-SET FOREGROUND-COLOR 3 BACKGROUND-COLOR 5. 05 LINE 2 COLUMN 10 VALUE “HELLO”. PROCEDURE DIVISION. ONLY-PARA. DISPLAY COLOR-SCREEN. DISPLAY TEST-SCREEN. STOP RUN.

Additional reference words: 3.00 Copyright Microsoft Corporation 1993.