Use the following steps to create an interface with ConsoleUI:
- Create an EGL source file
- Write a program that includes the language elements described in ConsoleUI
parts and related variables
- Generate Java™ code from the EGL source file
- Run the generated Java file as an application
Each of these tasks is detailed below.
Creating an EGL source file- In the workbench, from the EGL Perspective, select File>New>EGL Source
File. Or, from any perspective, select File>New>Other>EGL Source File..
- In the wizard screen, enter the following information:
- Source Folder: the directory location that will contain the EGL
source file.
- Package: the package location that will contain the EGL source
file. This field is optional.
- EGL Source File Name: the filename of the Console UI source file,
such as myConsoleUI.
- Select Finish to create the file. An extension (.egl) is
automatically appended to the end of the file name. The EGL source file appears
in the Project Explorer view and automatically opens in the default EGL editor.
Writing the ConsoleUI program
To populate the source file and create the interface, you will need ConsoleUI
variables and functions. to use the ConsoleUI language elements, which are
introduced in the overview help topic, and defined thoroughly in the individual
ConsoleUI Library, OpenUI Statement, Record types, and Enumerations help
topics.
A ConsoleUI application must include, at a minimum, the following elements:
- PROGRAM...END
- Function main ()
- OpenUI Statement
Note: Although the OpenUI statement is fundamental to the ConsoleUI,
you can write a successful ConsoleUI program without an OpenUI statement.
Generating Java code from EGL source
To generate a Java file:
- In the EGL Editor, right-click on the ConsoleUI file. A context menu displays.
- Select Generate.
Note: A ConsoleUI .egl source file cannot be generated to COBOL.
Run the generated Java file as an application
To run the generated Java file:
- From the Project Explorer, right-click on the generated Java (.java)
file. A context menu displays.
- Select Run>Run As>Java Application.
- Or, with the Java file open in the editor, select Run>Run As>Java
Application from the main menu.
- Your ConsoleUI will display to a window.
A ConsoleUI application can display in either a curses-based terminal session
or a Swing-based graphical window. UNIX® users have a more flexible display
choice, which is described in the ConsoleUI screen options for UNIX help
topic.