Syntax

Each screen description entry must start with a level-number from level 01 through level 49. At the top level (01), the screen is given a name. For example:

01  employee-info-screen.

The other levels of a screen description entry (level 03 and so forth) can either name subscreens within the top-level screen, or:

See Screen Description Entry in the ACUCOBOL-GT Reference Manual for a complete description of Screen Section screen description entry formats, their syntax and general rules.

When your program DISPLAYs a screen or ACCEPTs entries for a screen, the screen-name you reference in the DISPLAY or ACCEPT statement determines which fields are included. Everything subordinate to the screen-name is affected. For example, if you display a screen-name that's defined as a level 03 with two subscreens defined as level 05s below it, then all of the fields subordinate to the level 03 are displayed, and both of the subordinate level 05 screens and their attributes are also displayed.

Here are some examples.

This is an entry that names the screen and provides one literal:

01  employee-info-screen.
    03  emp-number-prompt value is "EMPLOYEE NUMBER: ".

This entry positions the cursor:

03  column plus 1 
        line plus 2.

This entry identifies a data item to receive a typed entry:

03  PIC  9(9) to emp-number.

This defines a subscreen:

03  pay-period-dates.
        05  PIC 9(6) USING period-start.
        05  PIC 9(6) USING period-end.

Here's a complete program example for a table. It accepts a simple table on one line:

IDENTIFICATION DIVISION.
PROGRAM-ID. TABLE-SAMPLE-1.

DATA DIVISION.
WORKING-STORAGE SECTION.

01  TABLE-1.
    03  TABLE-ITEM OCCURS 5 TIMES     PIC X(5).

SCREEN SECTION.

01  SCREEN-1.
    03 "TABLE ITEMS:".
    03 OCCURS 5 TIMES USING TABLE-ITEM, COLUMN + 2.

PROCEDURE DIVISION.

MAIN-LOGIC.   

    DISPLAY WINDOW ERASE.
    DISPLAY SCREEN-1.
    ACCEPT SCREEN-1.
    STOP RUN.

For additional examples that use tables, see OCCURS Clause.

The name that you give to a screen or subscreen in your Data Division must be referenced by the DISPLAY and ACCEPT statements that use the screen. Here's how that works.

First, you display the screen with a Format 2 DISPLAY statement. When this type of DISPLAY is executed, the screen-name in the DISPLAY statement tells which group of literals and data items should be displayed at the terminal. All of the literals in and subordinate to that screen-name definition are displayed in their appropriate positions. These typically serve as the prompts on the screen, guiding the end user. So the end user sees a form on the terminal, with multiple locations to enter data. That's why a Format 2 DISPLAY is said to be a form-level DISPLAY. Typical literals in a payroll program might be Employee Name: , Employee Number: , and Pay Period Ending Date: . The DISPLAY statement ignores the data items in the screen definition that are entry-only (TO) fields.

Second, you accept data into the screen with a Format 2 ACCEPT statement. When an ACCEPT statement of this type is executed, the screen-name that it references tells which screen of data items will be accepted. The ACCEPT statement ignores the literals in the screen definition as well as display-only (FROM) fields. The cursor moves to the position you've assigned to the first (non-literal) data item in the group, and waits for an entry. The end user can move around on the screen, from field to field and back again, with the tab and arrow keys (or other keys if you have customized the keyboard). When all items have been entered, the user presses a termination key to indicate that the screen is complete.

There are three types of screen description entries: