Elastic COBOL supports multiple display types for console operations (DISPLAY ... UPON CONSOLE and ACCEPT ... FROM CONSOLE). Several COBOL compiler vendors over the years have introduced GUI display artifacts into the language that allow addressable displays (screen row, column positioning), menus, buttons, check boxes, etc. Elastic COBOL supports all of those and it is controlled through runtime options and operating system environment settings.
By default when ACCEPT / DISPLAY operations are performed on the CONSOLE from a command-line COBOL program Elastic COBOL will bring up a new (Java AWT) window on the desktop to display it. Without further controls you will see green text on black background within a 24 x 80 character space typical for most applications. If you are running your Java program on a "headless" system such as a server-based system, or you do not have the X11 DISPLAY environment variable set (on Linux/UNIX/MacOS) you may see this error message:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
You can revert to using the UNIX / Linux "curses" library to create content within the current ASCII terminal window by using USECURSES runtime option. You may also have to set the operating system TERM variable to a termcap(5) ASCII terminal type supported by your system.
unset DISPLAY
export TERM=vt100
java -DUSECURSES=TRUE -cp /path/to/myprogram:/path/to/ecobol.jar myterminalprogram
Your system must have the ncurses library installed for addressable display operations to be performed on your terminal. Most Windows, UNIX and Linux systems support ncurses but it may not be installed by default, even on headless systems. Download it here.
If your console program does not use any of the GUI or CURSES operations you can compile your program with the compiler option -run:system meaning that operations to/from the CONSOLE (the default if nothing is specified on the ACCEPT or DISPLAY statements) will be redirected to the non-addressable-display files SYSIN and SYSOUT.
Example
A COBOL program with the ASCII terminal extensions (the AT keyword):
IDENTIFICATION DIVISION.
PROGRAM-ID. ticket2671-1.
*
* ticket2671 -- curses (ASCII terminal mode) run on cloud
* based linux servers without bitmapped display
*
WORKING-STORAGE SECTION.
01 ws-tmp PIC X(10).
PROCEDURE DIVISION.
* Display at screen location 10,10
DISPLAY 'Ticket #2671 - Test Curses' AT 1010 UPON CONSOLE.
* Accept on next line location 11,10
ACCEPT ws-tmp AT 1110 FROM CONSOLE
END PROGRAM.
This will display as this on a bitmapped addressable display with the Java AWT library (default or -DUSECURSES=FALSE in effect):
Fig. 1. Using a windowing system for CONSOLE operations.
If no bitmapped display is available the same program will be displayed in the current console window using ncurses ASCII terminal control characters:
Fig. 2. Using an ASCII terminal for CONSOLE operations
0 Comments