-4

I'm building a cobol system and I can't display an error message to the user using the screen section. How can I do this?

And how do I get the ESC key that the user presses to return to the menu?

I'm using GNUCobol and OpenCobol.

  • this question is way to broad. you are basically asking how do I do CICS screen programming. – SaggingRufus Jun 28 '19 at 14:54
  • 1
    It highly depends on what you currently do, but using `SCREEN SECTION` to show an error message seems to be not a big deal, if you show your current code, that part that does not work and possibly the output of `cobcrun --info` then we would be able to answer something useful. See the FAQ at https://stackoverflow.com/help/how-to-ask – Simon Sobisch Jul 10 '19 at 17:21

1 Answers1

0

Here comes a very brief example of how you can use screen section in cobol.

*>****************************************************************
*> Author:mnemonics
*> Date:
*> Purpose:
*> Tectonics: cobc
*>****************************************************************
IDENTIFICATION DIVISION.
PROGRAM-ID. using-screen.
DATA DIVISION.
FILE SECTION.
WORKING-STORAGE SECTION.
01 id-in-ws pic x(4).
screen section.
01 id-input line 5 col 10 pic x(4) to id-in-ws. 
01 id-input-fld line 5 col 5 value "id: ".
PROCEDURE DIVISION.
MAIN-PROCEDURE.
    DISPLAY id-input-fld
    accept id-input

    STOP RUN.
END PROGRAM using-screen.

Observe the section screen. You have to declare variables that will represent the fields inside the encapsulation of the screen section. The inserted value will be stored in the variable declared under the working-storage section. A great article about how to use screen can be read in the following web page: Using screens in COBOL.

Mnemonics
  • 679
  • 1
  • 10
  • 26