consolecobolwindows-consolegnucobol

Foreground color doesn't work in Gnucobol for Windows


I am using GnuCobol for Win 10. I need to display a console screen with black background and green foreground but doesn't work, It doesn't using the foreground color, neither the background color does. This is my code:

   IDENTIFICATION DIVISION.
   PROGRAM-ID. FillerExample.
   DATA DIVISION.
   WORKING-STORAGE SECTION.
   01 record-example.
       05 FILLER PIC X(11) VALUE "hello world".
   SCREEN SECTION.
   01 DISPL-SCREEN AUTO.
       05 BACKGROUND-COLOR 0 FOREGROUND-COLOR 2.
       05 LINE 02 COLUMN 20 using record-example.
   PROCEDURE DIVISION.
   Display-Fillers.
       DISPLAY DISPL-SCREEN
       STOP RUN.

I need some additional setting in Windows console or some flag setted for compiling?

This is the snapshot from the windows console:

enter image description here


Solution

  • Just made a little change from level number 05 to 07:

       07 LINE 02 COLUMN 20 using record-example.
    

    And you'll get the desired result: hello world in background black / foreground green

    image of screen