Menu

#946 ERROR on DISPLAY STATEMENT

unclassified
not-our-bug
Chuck H.
5 - default
2024-06-15
2024-02-10
No

The following example program requires typing two fields on the screen, a name and a code.
If nothing is typed then it displays an error message requiring you to type the single field.
See screenshot.

To view the bug, proceed as follows.

a. When the program asks you to type the name, do not type anything but just press Enter see ERR10.PNG
b. The system displays the error message (using some DISPLAYS) see ERR20.PNG
c. Press Enter again to exit from the message
d. The system prompts you to enter the Name field again
e. do not type anything but just press Enter again
f. The program should display the same error message again.
g. The program executes the same DISPLAY statements again but this time the message is not displayed on the screen.
How come ?

       >>SOURCE FORMAT IS FREE
       REPLACE ==:BCOL:== BY ==with BACKGROUND-COLOR==
               ==:FCOL:== BY ==FOREGROUND-COLOR==.
IDENTIFICATION DIVISION.
program-id. TESTERROR.

ENVIRONMENT DIVISION. 
Configuration Section.
 SPECIAL-NAMES.
   CRT STATUS IS wKeyPressed.

DATA DIVISION.
*> **************************************************************
WORKING-STORAGE SECTION.
*> **************************************************************
  01 Black        constant as 00.
  01 Blue         constant as 01.
  01 Green        constant as 02.
  01 Cyan         constant as 03.
  01 Red          constant as 04.
  01 Magenta      constant as 05.
  01 Orange       constant as 06.
  01 Brown        constant as 06.   *> same color code as yellow
  01 LightGrey    constant as 07.   *> Light Gray

  01 Grey         constant as 08.   *> Dark Gray
  01 LightBlack   constant as 08.   *> same color code as Grey
  01 LightBlue    constant as 09.
  01 LightGreen   constant as 10.
  01 LightCyan    constant as 11.
  01 LightRed     constant as 12.
  01 LightMagenta constant as 13.
  01 Pink         constant as 13.
  01 Yellow       constant as 14.
  01 White        constant as 15.  *> white

01  AnageRec value space.
       03 AnageCodAge pic x(10) value space. *> code AGENT
       03 AnageRagSoc pic x(30) value space. *> NAME

*> Values that may be returned in CRT STATUS (or COB-CRT-STATUS)
78  K-ENTER       VALUE 0000.
78  K-UP          VALUE 2003.
78  K-DOWN        VALUE 2004.
78  K-LEFT        VALUE 2009.
78  K-RIGHT       VALUE 2010.
78  K-ESCAPE      VALUE 2005.
78  K-TAB         VALUE 2007.
78  K-BACKTAB     VALUE 2008.
78  K-PAGEUP      VALUE 2001.
78  K-PAGEDOWN    VALUE 2002.

01  wKeyPressed  PIC  9(04) VALUE 9999.
77  NumFields    pic  9(02) value 2. *> number of fields on screen

01  wBox-bco     pic 9(02) value cyan.
01  wBox-fco     pic 9(02) value black.

01 wRetCode     PIC 9999 value zero.
01 wFunc-NumVal PIC 9999 value zero.

77 Pivot    pic 9(02) value 01.
77 dbc      pic 9(04) value green. *> display backgr.color
77 dfc      pic 9(04) value white. *> display foregr.color
77 abc      pic 9(04) value 00. *> accept  backgr.color
77 afc      pic 9(04) value 15. *> accept  backgr.color
77 Pro      pic x(01) value '_'.
77 wHeader  pic x(80) value space.

01  wString   pic x(31) value space.

01 ER pic x.
   88 NoErrors value 'N'.
   88   Errors value 'Y'.

01  wCursorShow       BINARY-SHORT SIGNED value 2.
01  wCursorHide       BINARY-SHORT SIGNED value 0.

*> SAVE/RESTORE SCREEN VARIABLES
01 wScreenName        PIC X(256) value space.
01 wiScrOk            BINARY-LONG value zero.

01 Btabmess.
  03 Bmess     pic x(30) occurs 20 value space.

*> **************************************************************
*>           P R O C E D U R E   D I V I S I O N
*> **************************************************************
PROCEDURE DIVISION.
    set environment 'COB_SCREEN_EXCEPTIONS' TO 'Y'.
    set environment 'COB_SCREEN_ESC'        TO 'Y'.
    set environment 'COB_LEGACY'            TO '1'

*> ************************************************************************************
*> D I S P L A Y    S C R E E N
*> ************************************************************************************
   string  ' SAMPLE TEST APPLICATION ' delimited by size into wHeader
   display wHeader at 0101 with  Background-Color green Foreground-Color white highlight
   display ' ESC-<Exit>                                                                     '
                   at 2501 with Background-Color green Foreground-Color white
  display ' Name ..................:' at 0501 with  Background-Color dbc Foreground-Color dfc
  display AnageRagSoc                 at 0527 with  Background-Color abc Foreground-Color afc
  display ' Code..:'                  at 0561 with  Background-Color dbc Foreground-Color dfc
  display AnageCodAge                 at 0570 with  Background-Color abc Foreground-Color afc
  continue.

LOOP-ACCEPT.
   *> re-show the cursor
   call static 'curs_set' using by value wCursorShow end-call
   go to acc01 acc02 depending on Pivot.

ACC01.
   *> NAME
   accept AnageRagSoc at 0527 with  Background-Color abc Foreground-Color afc
          update prompt character is pro auto-skip reverse-video
   go EVALUATE-KEY.
ACC02.
   *> CODE
   accept AnageCodAge at 0570 with  Background-Color abc Foreground-Color afc
          update prompt character is pro auto-skip reverse-video
   go EVALUATE-KEY.


EVALUATE-KEY.
     EVALUATE wKeyPressed
        *> ******************************************************************
        *> ENTER = CONTROLS ON SCREEN FIELDS
        *> ******************************************************************
        WHEN K-ENTER
        WHEN K-TAB
        WHEN K-DOWN
                perform CtrFields thru CtrFieldsEx
                if Errors
                   continue
                else
                   *> go to next field on screen
                   compute Pivot = Pivot + 1
                   if Pivot > NumFields move 1 to Pivot end-if
                end-if

        WHEN K-BACKTAB
        WHEN K-UP
                 perform CtrFields thru CtrFieldsEx
                 if Errors
                    continue
                 else
                    *> go to previous field on screen
                    compute Pivot = Pivot - 1
                    *> with following statement, when cursors is on 1st field
                    *> it remains there (non to go - wrap - on last filed)
                    if Pivot < 1 move 1 to Pivot end-if
                 end-if

        *> ******************************************************************
        *> ESCAPE = EXIT
        *> ******************************************************************
        when K-ESCAPE
            go to END-OF-PROGRAM

     END-EVALUATE

     GO LOOP-ACCEPT.

 *> *****************************************************************************
 *>                        E N D     O F    P R O G R A M
 *> *****************************************************************************
 END-OF-PROGRAM.
     Goback.

 *> *****************************************************************************
 *>                 C H E C K     F I E L D S   C O N T E N T
 *> *****************************************************************************
 CtrFields.
     set NoErrors to true
     go to ctr01 ctr02 depending on Pivot.
 CTR01.
     if AnageRagSoc = space
        set Errors to true
        move lightgreen to wbox-bco move white to wbox-fco
        move '111111111111111111111111111111'  to Bmess(1)
        move '        >>> ERROR 1 <<<       '  to Bmess(2)
        move '111111111111111111111111111111'  to Bmess(3)
        move '  Please Type a NAME          '  to Bmess(4)
        move '111111111111111111111111111111'  to Bmess(5)
        move '111111111111111111111111111111'  to Bmess(6)
        move '---- enter to return ---------'  to Bmess(7)
        perform DisplayErrorMessage thru DisplayErrorMessageEx
     end-if
     go CtrFieldsEx.
 CTR02.
     if AnageCodAge = space
        set Errors to true
        move lightred to wbox-bco move yellow to wbox-fco
        move '+----------------------------+'  to Bmess(1)
        move '|       >>> ERROR 2 <<<      |'  to Bmess(2)
        move '|2222222222222222222222222222|'  to Bmess(3)
        move '|     Type a CODE !!!        |'  to Bmess(4)
        move '|2222222222222222222222222222|'  to Bmess(5)
        move '|2222222222222222222222222222|'  to Bmess(6)
        move '+- Enter to return ----------+'  to Bmess(7)
        perform DisplayErrorMessage thru DisplayErrorMessageEx
     end-if
     go CtrFieldsEx.
 CtrFieldsEx. exit.

DisplayErrorMessage.
   move Z'DUMPSCREEN.TMP' to wScreenName
   call static 'scr_dump' using by reference wScreenName returning wiScrOk end-call.
   display Bmess(1) at line 04 col 10 :BCOL: wbox-bco :FCOL: wbox-fco
   display Bmess(2) at line 05 col 10 :BCOL: wbox-bco :FCOL: wbox-fco
   display Bmess(3) at line 06 col 10 :BCOL: wbox-bco :FCOL: wbox-fco
   display Bmess(4) at line 07 col 10 :BCOL: wbox-bco :FCOL: wbox-fco
   display Bmess(5) at line 08 col 10 :BCOL: wbox-bco :FCOL: wbox-fco
   display Bmess(6) at line 09 col 10 :BCOL: wbox-bco :FCOL: wbox-fco
   display Bmess(7) at line 10 col 10 :BCOL: wbox-bco :FCOL: wbox-fco
   accept omitted

   call static 'scr_restore' using by reference wScreenName returning wiScrOk end-call
   call static 'refresh' returning wiScrOk end-call

      *> CALL 'CBL_DELETE_FILE' USING wScreenName
      continue.
DisplayErrorMessageEx. exit.
1 Attachments

Related

Bugs: #946

Discussion

<< < 1 2 3 (Page 3 of 3)
  • Arnold Trembley

    Arnold Trembley - 2024-06-15

    Normally Chuck builds three different versions of pdcurses.dll with the following names:

    pdcurses-vt.dll
    pdcurses-wincon.dll
    pdcurses-wingui.dll

    And the "pdcurses-wincon.dll" is copied to "pdcurses.dll".

    The wincon version of pdcurses.dll should work correctly in either the CMD.EXE shell or the Windows Terminal shell for cmd.exe. Wingui uses a separate graphic window.

    The semigraphic characters should display as expected when using wincon or wingui versions of pdcurses.dll. I'm not sure what the issue with VT terminal support is, but it could be related to character set code-pages, or in attempting to emulate 7-bit ASCII terminals.

    I'm not sure how the OpenCobolIDE "pyqde-console.exe" shell handles terminal display, but I suspect it is different from pdcurses wincon or wingui terminal emulation.

     

    Last edit: Arnold Trembley 2024-06-15
    • Eugenio Di Lorenzo

      Many thanks for the clarifications.
      Can you o someone else tell what the differences are between
      pdcurses.dll
      pdcurses-vt.dll
      pdcurses-wincon.dll
      pdcurses-wingui.dll

      and why do these versions exist ?

       
      • Arnold Trembley

        Arnold Trembley - 2024-06-15

        PDCursesMod can be built to support 3 different terminal types on windows. In my opinion wincon is the most useful, and TUI-Tools should work best with wincon. But you cannot do GUI style things in wincon (cmd.exe and Windows Terminal/cmd.exe), so Chuck Haatvedt is interested in building GUI style interfaces and likes wingui. VT terminal emulation is probably more similar to traditional unix or linux environments.

        The three different versions exist so that GnuCOBOL users can switch their pdcurses.dll file to use different terminal emulation on Windows, without recompiling their COBOL programs. "pdcurses.dll" is part of the GnuCOBOL runtime environment.

        Simon or Chuck may be able to give a better explanation than I can. I normally use the wincon version of pdcurses.dll.

         
        • Simon Sobisch

          Simon Sobisch - 2024-06-15

          concerning the PDCurses ports (there are also more, but the others have
          additional dependencies) see
          https://github.com/Bill-Gray/PDCursesMod/?tab=readme-ov-file#ports and
          then the referenced readme file for the ports

           
  • Eugenio Di Lorenzo

    second question.
    Chuck's version does not display semigraphic characters correctly. Lines, angles, T ...
    See screenshot
    Can you say why?

     

    Last edit: Eugenio Di Lorenzo 2024-06-13
<< < 1 2 3 (Page 3 of 3)

Log in to post a comment.