[an error occurred while processing this directive]

HP OpenVMS Systems Documentation

Content starts here

HP COBOL
User Manual


Previous Contents Index

Because the ACCEPT statements in Example 11-11 contain EDITING phrases, a person using the form in Figure 11-13 can use any of the keys listed in Table 11-3 for field editing purposes to make corrections or modifications.

11.3 Designing Video Forms with Screen Section ACCEPT and DISPLAY (Alpha, I64)

The Screen Section feature provides an efficient alternative to the ACCEPT and DISPLAY extensions for designing video forms. Screen Section, which is based on the X/Open CAE Specification for COBOL, is also a Hewlett-Packard extension to the ANSI Standard. It enables you to design video forms in a single section of your HP COBOL program. Then, in the Procedure Division, you can accept or display an entire screen of data with a single ACCEPT or DISPLAY statement, instead of multiple statements.

You can design your form as follows:

  1. In the SPECIAL-NAMES paragraph in the Environment Division, you can optionally do the following:
    • Specify the cursor position with the CURSOR IS option.
    • Set up an indicator to discover the cause of termination of an ACCEPT statement, with the CRT STATUS IS option.

    For example:


    SPECIAL-NAMES.
    
        CURSOR IS CURSOR-POSITION
    
        CRT STATUS IS CRT-STATUS.
    
  2. You can use the Screen Section in the Data Division to define a screen description entry to describe each input and output item within the video form. Do this for each screen in your application.
    For example:


    SCREEN SECTION.
    
    01 MENU-SCREEN BLANK SCREEN FOREGROUND-COLOR 7 BACKGROUND-COLOR 1.
       02 MENU-SCREEN-2.
          03 TITLE-BAR
             FOREGROUND-COLOR 7 BACKGROUND-COLOR 4.
             04 LINE 1 PIC X(80) FROM EMPTY-LINE.
             04 LINE 1 COLUMN 32 VALUE "Daily Calendar".
    

    See Section 11.3.1 for a description of the options available in the Screen Section.
  3. Then you use the ACCEPT and DISPLAY statements in the Procedure Division with the screen description entries described in the Screen Section to accept or display each entire screen or part of the screen. During a DISPLAY, all output and update screen items are displayed. During an ACCEPT, all input and update screen items are accepted.
    For example:


        DISPLAY MENU-SCREEN.
        .
        .
        .
        ACCEPT MENU-SCREEN.
    

11.3.1 Using Screen Section Options (Alpha, I64)

You design your screens with screen description entries in the Screen Section of the Data Division of your program. Three formats are available for a screen description entry (and are completely defined in the Data Division chapter of the HP COBOL Reference Manual):

  • Format 1 --- A group screen item
  • Format 2 --- An elementary output screen item with a literal value; it includes the VALUE clause
  • Format 3 --- An elementary output, input, or update screen item; it includes the PICTURE clause

Table 11-4 shows the optional clauses you can use in a screen description entry to specify character attributes, the formats to which they apply, and a summary of their functions. (They are completely described in the Data Division chapter of the HP COBOL Reference Manual.)

Table 11-4 Character Attribute Clauses for Screen Description Formats (Alpha, I64)
Clause Formats Function
AUTO 1,3 Moves the cursor to the next field when the last character of a field is entered.
BACKGROUND-COLOR 1, 2, 3 Specifies by number (in the range 0--7) the screen item's background color (see the color list that follows).
BELL 2, 3 Sounds the audio tone on the workstation or terminal.
BLANK LINE 2, 3 Clears the line before displaying the screen item.
BLANK SCREEN 1, 2, 3 Clears the screen before displaying the screen item.
BLANK WHEN ZERO[ES] 3 Replaces zeros with spaces when a screen item's value is zero.
BLINK 2, 3 Causes the displayed item to blink.
COLUMN NUMBER 2, 3 Specifies the horizontal position of an item on the screen.
ERASE EOL 2, 3 Clears the line from the cursor position to the end.
ERASE EOS 2, 3 Clears the screen from the cursor position to the end.
FOREGROUND-COLOR 1, 2, 3 Specifies by number (in range 0--7) the screen item's foreground color. See the color list that follows.
FULL 1, 3 Specifies that a screen item must either be left completely empty or be entirely filled with data.
HIGHLIGHT 2, 3 Specifies that the field is to appear on the screen with the highest intensity.
JUSTIFIED RIGHT 3 Specifies nonstandard data positioning. This can cause truncation of the leftmost characters if the sending item is too large. Otherwise, this aligns the data at the rightmost character position.
LINE NUMBER 2, 3 Specifies the vertical position of an item on the screen.
LOWLIGHT 2, 3 Specifies that the field is to appear on the screen with the lowest intensity. If only two levels of intensity are available, LOWLIGHT is the same as normal.
REQUIRED 1, 3 Specifies that at least one character must be entered in the input or update field.
REVERSE-VIDEO 2, 3 Specifies that the foreground and background colors be exchanged.
SECURE 1, 3 Specifies that no characters are displayed when the input field is entered.
SIGN LEADING [SEPARATE] 1, 3 Specifies the existence of a sign character as the leading character in the field. The SEPARATE option is always in effect if the screen item has an 'S' in the PICTURE clause. Therefore, for a screen item, the sign character never shares its position with a digit.
SIGN TRAILING [SEPARATE] 1, 3 Specifies the existence of a sign character as the trailing character in the field. The SEPARATE option is always in effect if the screen item has an 'S' in the PICTURE clause. Therefore, for a screen item, the sign character never shares its position with a digit.
UNDERLINE 2, 3 Specifies that each character of the field is to be underlined when displayed.
USAGE DISPLAY 1, 3 Specifies the internal format of a data item as DISPLAY (the default).

When you specify the foreground and background colors for a screen item, you use numbers in the range 0--7, which represent specific colors as described in Table 11-5. Note that these colors are supported only on terminals that support ANSI Standard color sequences.1

Table 11-5 Color Table
Color Color Value Color Color Value
Black 0 Red 4
Blue 1 Magenta 5
Green 2 Yellow/Brown 6
Cyan 3 White 7

Note

1 This does not include the VT100, VT200, VT300, VT400, and VT500 series terminals. On workstations that emulate these terminal types, this restriction may not apply.


Previous Next Contents Index