PreviousMouse Support for Character Interfaces Using ScreensNext"

Chapter 9: Screens

Screens is a screen painter designed to enable you to rapidly specify screen layouts and generate COBOL code for screen handling. Powerful functionality is provided by Screens to support easy specification of screen layouts and their subsequent modification.

9.1 Overview

The Screens facility enables you to:

9.2 Operation

This section describes how to invoke Screens, the use of the cursor movement keys when designing screens and the menus and functions available in Screens.

9.2.1 Invoking Screens

To invoke Screens, enter the command line:

component [filename]

where the parameters are:

component The program-name for the system component to be invoked, in this case Screens:
DOS and OS/2
Windows
UNIX
screens screensw cobrun screens
filename The name of the file to initially load.

Windows and OS/2:
Alternatively, on Windows and OS/2, if you have created a group for COBOL, you double-click on the appropriate program icon to invoke the component.

You can also invoke Screens from the COBOL Editor by selecting Ctrl+F6=draw/forms from the COBOL Editor main menu, followed by F7=screens.


Note: Screens enables you to load files created with Forms and Forms-2 utilities. Files created with Forms-2 must have the file extensions .s00 and .s01 for text and data respectively. You cannot load files with other extensions, such as .s03 or .s04.


The initial screen that appears displays an information line and the main menu, which occupies two lines. The rest of the screen displays a stored screen form if filename is specified, otherwise it is blank. Other options are accessed from the Alternate and Control menus. Each menu and its options are described in later sections.

The information line and main menu are shown in Figure 9-1:



Figure 9-1: Screens Information Line and Main Menu

9.2.1.1 The Information Line

The information line initially displays:

As you work with Screens, the information line is updated with the following information:

Information
Description
form-name The name given to the form when it was loaded or saved appears at the beginning of the information line. If the form is new, then "New form" is displayed. If the name is more than eight characters, it is truncated.
attribute The attribute currently associated with the next character to be typed is displayed as part of this word. If attributes are suppressed, the word Attribute disappears.
field/group-name If the cursor is currently positioned on a field, the word field appears on the information line. The name of the field is displayed if one has been given. If no name has been given, then the name in the USING, TO, or FROM clause is displayed. If the cursor is currently positioned inside a group, then the field display is replaced with the group display.
group order This applies only to groups and displays H or V depending on whether the group is accepted first horizontally or vertically.
row and column The position of the cursor is continually displayed.

The help function (F1=help) is available from each menu within the Screens utility. Press F1=help to display the help screen for additional information about the options available on the current menu.

9.2.2 Key Functions in Screens

In addition to the options available on each menu, the following keys have particular functions while you are using the Screens utility. Some of these keys behave differently when used with specific options within Screens. The table below shows the general use of these keys. Additional uses of these keys are described in the discussion of the specific option.

Some of them are notional key-names which may not be present on your keyboard. For IBM keyboards, the appropriate key combinations are shown in parentheses at the end of the notional key description.

Key
Function
<left-arrow> Moves the cursor left one character position.
<right-arrow> Moves the cursor right one character position.
<up-arrow> Moves the cursor up one line unless Scroll Lock is on, which instead causes the text to move down one line.
<down-arrow> Moves the cursor down one line unless Scroll Lock is on, which instead causes the text to move up one line.
Tab Moves the cursor to the next tab position to the right.
Backtab Moves the cursor to the next tab position to the left.
Backspace Deletes the character to the left of the cursor position, and moves the cursor left one character position.
Enter Moves the cursor to the first character position on the next line.
Home Moves the cursor to column one of the same line.
End Moves the cursor to the position after the last character on the current line, or to column 80 if there are no characters after the current cursor position.
Del Deletes the character at the cursor position.
Ctrl+End Toggles menus on and off.

9.2.3 Menus

The Screens menus are organized to provide rapid access to the most commonly used functions. You can access help menus from any Screens menu by pressing F1=help. This calls the help screen for the option from which it was called.

The hierarchy of the three menus central to Screens' operation is shown in Figures 9-2, 9-3 and 9-4.

The menus described in this section appear in alphabetical order, apart from the Index Program menus which are covered in the section Index Programs later in this chapter.



Figure 9-2: The Screens Main Menu



Figure 9-3: The Alternate Menu



Figure 9-4: The Control Menu

9.2.3.1 Alternate Menu

The Alternate menu is displayed by holding down Alt from the Screens main menu. This menu is shown in Figure 9-5.



Figure 9-5: The Alternate Menu

The Alternate menu displays functions that enable you to perform the following actions:

9.2.3.2 Attribute Selection Menu

Pressing Alt+F9=attribute-palette from the Screens main menu displays the Attribute Selection menu. This menu is displayed in Figure 9-6.



Figure 9-6: The Attribute Selection Menu

The Attribute Selection menu displays functions that enable you to select the default attribute and the five attributes that are available to you from the Screens main menu. These are known as the roll attributes.

9.2.3.3 Block Menu

Pressing F7=cut-to-block or F8=copy-to-block from the main menu when you have marked a block displays the Block menu. This menu is shown in Figure 9-7.



Figure 9-7: The Block Menu

The Block menu displays functions that enable you to perform the following actions:

9.2.3.4 Control Menu

Holding down the Ctrl key from the Screens main menu displays the Control menu. This menu is shown in Figure 9-8.



Figure 9-8: The Control Menu

The Control Menu displays functions that enable you to perform the following actions:

9.2.3.5 Draw Menu

Pressing F6=draw from the Control menu displays the Draw menu. This menu is shown in Figure 9-9.



Figure 9-9: The Draw Menu

The Draw menu displays functions that enable you to draw single or double lines to enhance the appearance of your screens.

9.2.3.6 Field Menu

Selecting a valid field and pressing F3=field from the Screens main menu displays the Field menu as shown in Figure 9-10, and its associated popup menu.



Figure 9-10: The Field Menu

The Field menu displays functions that enable you to specify a clause to be associated with the selected field. See the section Screen Section Clauses later in this chapter for more information on the clauses shown in Figure 9-10 and its associated popup menu.

9.2.3.7 Generate-COBOL Menu

Pressing Alt+F5=generate-COBOL from the Screens main menu displays the initial Generate-COBOL menu. This menu is displayed in
Figure 9-11.



Figure 9-11: The Initial Generate-COBOL Menu

After typing a filename and pressing ENTER, the Generate-COBOL menu is displayed as shown in Figure 9-12.



Figure 9-12: The Generate-COBOL Menu

The Generate-COBOL menu displays functions that enable you to perform the following actions:

9.2.3.8 Group Menu

Selecting a valid group and pressing F4=group from the Screens main menu displays the Group menu. This menu is shown in Figure 9-13.



Figure 9-13: The Group Menu

The Group menu displays functions that enable you to perform the following actions:

9.2.3.9 Group Properties Menu

Pressing F2=assign-properties from the Group menu displays the Group Properties menu, as shown in Figure 9-14, and an associated popup menu.



Figure 9-14: The Group Properties Menu

The Group Properties menu displays functions that enable you to specify a clause to be associated with the selected group. See the section Screen Section Clauses later in this chapter for more information on the clauses you can specify from this menu and its associated popup men.

9.2.3.10 Load Menu

Pressing Alt+F3=load from the Screens main menu displays the Load form menu. This menu is shown in Figure 9-15.



Figure 9-15: The Load Menu

The Load form menu enables you to load a previously saved screen, with the option of using the Directory facility to show all screens available for loading.

9.2.3.11 Mark Fields Menu

Pressing F7=mark-fields from the Generate-COBOL menu displays the Mark Fields menu. This menu is shown in Figure 9-16.



Figure 9-16: The Mark Fields Menu

The Mark Fields menu displays functions that enable you to perform the following actions:

9.2.3.12 Save Menu

Pressing Alt+F4=save from the Screens main menu displays the Save menu. This menu is shown in Figure 9-17.



Figure 9-17: The Save Menu

The Save menu enables you to save a screen, with the option of using the Directory facility to show all screens previously saved.

9.2.3.13 Screens Main Menu

The Screens main menu is displayed when you invoke Screens (see the section Invoking Screens earlier in this chapter). This menu is shown in Figure 9-18.



Figure 9-18: The Screens Main Menu

The Screens main menu provides access both to other menus and direct functions. The Screens main menu displays functions that enable you to perform the following actions:

9.2.4 Functions

Screens functions are accessed from menus. The function-names are sometimes abbreviated on the menus.

The following section contains a quick reference listing of all the functions available in Screens. This listing is followed by detailed descriptions of these functions.

9.2.4.1 Function Access

The following list shows the available functions in alphabetical order and indicates the keys you must press to access them. Thus, to determine the path to access a given function, follow the sequence of keystrokes. For example, to reach the Mark Prime Key function, you press the Alt+F5=generate-COBOL key, followed by the F7=mark-fields key, followed by F2=mark-field-key.

Function
Menu Access Keys
Assign Properties F4, F2
Attribute Roll F6
Attribute Selection Alt+F9
Attributes Alt+F2
Clear Screen Alt+F6
Copy from Block F7, F3 or F8, F3
Copy to Block F8
Cut to Block F7
Define Field F3
Define Group F4
Delete Field Definition Ctrl+F9
Delete Group Definition Ctrl+F10
Delete Group Horizontally F4, F5
Delete Group Vertically F4, F6
Delete Line Alt+F7
Draw Ctrl+F6
Edit Field Clause F3, F3
Edit Group Clause F4, F2, F3
Escape Escape
Generate-COBOL Alt+F5
Generate Data Descriptions Alt+F5, F2
Generate Index Program Alt+F5, F5
Generate Skeleton Program Alt+F5, F3
Highlight Left Special Character Ctrl+F3
Highlight Right Special Character Ctrl+F4
Insert Line Alt+F8
Load File Alt+F3
Mark Block F2
Mark Fields Alt+F5, F7
Mark First Alternative Key Alt+F5, F7, F3
Mark Prime Key Alt+F5, F7, F2
Mark Second Alternative Key Alt+F5, F7, F4
Mark Third Alternative Key Alt+F5, F7, F5
Paint Attribute F5
Paste Block F7, F2 or F8, F2
Read Attribute Ctrl+F8
Read Character Ctrl+F7
Repeat Group Horizontally F4, F3
Repeat Group Vertically F4, F4
Restore Block F9
Save File Alt+F4
Screen Name Alt+F10
Screen to Editor Ctrl+F2
Select Attributes
Select Field Clause F3, F2
Select Group Clause F4, F2, F2
Select Special Character Ctrl+F5
Set Character Attribute Ctrl+F6, F4
Set Clear Screen Mode Alt+F5, F6
Set Default Attribute Alt+F9, F7
Set Drawing Mode Ctrl+F6, F2
Set Field Order F10
Set Field Type F3, F4
Set IDX Mode Alt+F5, F8
Set Line Mode Ctrl+F6, F3
Set Monitor Type Alt+F5, F4
Set Roll Attribute Five Alt+F9, F6
Set Roll Attribute Four Alt+F9, F5
Set Roll Attribute One Alt+F9, F2
Set Roll Attribute Three Alt+F9, F4
Set Roll Attribute Two Alt+F9, F3
Show Previously Saved Screens Alt+F3, F2 or Alt+F4, F2
Store Block F7, F4 or F8, F4
Unmark Key Alt+F5, F7, F6

9.2.4.2 Function Descriptions

This section describes the functions available with Screens. Functions for use with the Index program are described later in this chapter.

Assign Properties

Displays the Assign Properties menu which is described in the section Menus. For a description of the functions available on this menu see Select Group Clause, Unselect Group Clause and Edit Group Clause.

Attribute Selection

Displays the Attribute Selection menu which is described in the section Menus. For a description of the functions available on this menu see the sections Set Roll Attribute One, Set Roll Attribute Two, Set Roll Attribute Three, Set Roll Attribute Four, Set Roll Attribute Five and Set Default Attribute.

Attributes

Toggles the use of attributes on and off. When attributes are on, the word Attribute is displayed on the information line in the current attribute (specified by the Set Default Attribute function) and any text entered is painted in the current attribute.

When attributes are off, the word Attribute is not displayed on the information line, and any text entered is painted in the default attribute.

If you are displaying text in a Double-Byte Character Set (DBCS), when you paint attributes on the first byte of a double-byte character, the character might appear corrupt until you paint the second byte.

Clear Screen

Clears the current form from the screen. If the current form has changed since it was last saved, the following prompt appears:

Clear without saving ? Y/N

Pressing Y or y clears the screen, abandoning any changes made since the form was last saved. Pressing N or n leaves the current form unchanged, abandoning the request to clear.

Copy from Block

The marked block is copied to the screen in its current position. The block remains highlighted and you stay in the Block menu. You cannot copy a block over an area containing a field or group definition. See the section Mark Block for information on marking a block.

Copy to Block

Places the marked block in a temporary buffer. The block remains visible on the screen in the position from which it has been copied. The Block menu is then displayed. Subsequent cursor movements move the block around the screen leaving the original block unchanged. See the section Mark Block for information on marking a block.

Cut to Block

Places the marked block in a temporary buffer. The block remains visible on the screen in the position from which it has been cut. The Block menu is then displayed. See the section Mark Block for information on marking a block.

Define Field

Enables you to define a field. You can do this in two ways:

  1. Place the cursor on a set of caret characters and press F3=field

  2. Mark an area using the Mark Block function then press F3=field. This method inserts a set of carets (^) over the marked area. Adjacent fields can be specified this way. See the section Mark Block for information on marking blocks.

Once a field has been selected, the caret characters are replaced by a COBOL picture string, and the Field menu is displayed (described in the section Menus earlier in this chapter). See the sections Select Field Clause, Edit Field Clause and Set Field Type for information on the functions available on the Field menu.

Minimal validation is performed on the field name, and only simple validation is performed on picture strings. The caret characters depict fields only when defined as fields; they can still be used as text characters.


Note : The maximum number of data entries a screen can contain is 200. This can be any combination of fields or groups. If you attempt to use more than 200 entries on a screen the following message appears:

Field table full

and the results on the existing fields are undefined. Using groups avoids the need for so many entries, and also makes the generated code smaller and easier to maintain.


Define Group

Displays the Group menu (described in the section Menus earlier in this chapter) provided that the cursor is positioned in a previously defined group, or an area is marked using the Mark Block function. The marked area must contain at least one data field.

See the sections Assign Properties, Repeat Group Horizontally, Repeat Group Vertically, Delete Group Horizontally and Delete Group Vertically for information on the functions available from the Group menu.


Note: The maximum number of data entries a screen can contain is 200. This can be any combination of fields or groups. If you attempt to use more than 200 entries on a screen the following message appears:

Field table full

and the results on the existing fields are undefined. Using groups avoids the need for so many entries, and also makes the generated code smaller and easier to maintain.


Delete Field Definition

Removes all references to the field containing the cursor as a field.

Delete Group Definition

Removes the group definition and all group occurrences from the original marked item that was used to define that group. If the size of the fields inside a group requires editing, the group must first be deleted, then edited, and then redefined as a group.

Delete Group Horizontally

Deletes a group occurrence to the left until there is one occurrence left.

Delete Group Vertically

Deletes a group occurrence upwards until there is one occurrence left.

Delete Line

Deletes the line on which the cursor is positioned and moves the lines below this line up by one. You cannot delete a line containing fields, nor can you delete a line in the middle of a group. To delete a line containing fields, you must first delete the fields using the Delete Field Definition function. See the section Delete Field Definition for more information on this function.

Draw

Displays the Draw Menu (described in the section Menus earlier in this chapter) to enable you to use line drawing to aid the presentation of diagrams and charts. See the sections Set Drawing Mode, Set Line Mode and Set Background Attribute for more information on the functions available on the Draw menu.

Edit Field Clause

Enables you to change the additional information related to a previously specified clause. This option only applies to the Field name, PROMPT, SIZE, TO, FROM and USING clauses. See the section Select Field Clause for information on setting a clause for a field.

Edit Group Clause

Enables you to change the additional information related to a previously specified clause. This option only applies to the Group-name and PROMPT clauses. See the section Select Group Clause for more information on setting a clause for a group.

Escape

Returns to the higher level menu or exits from Screens altogether if you are on the Screens main menu.

Generate-COBOL

Displays the Generate-COBOL menu which is described in the section Menus. For a description of the functions available on this menu see the sections Generate Data Descriptions, Generate Skeleton Program, Set Monitor Type, Generate Index Program, Set Clear Screen Mode, Mark Fields and Set IDX Mode.

Enter the name of the output file to be created, or use the F2=directory option. If you pressed Alt+F5=generate-COBOL and the current form has changed since it was last saved, the following message appears:

Generate without saving? Y/N

Having entered a valid output name, the Generate-COBOL menu is displayed. This menu is shown in Figure 9-12.

Screens generates code in two ways:

  1. Standard COBOL copyfiles and source files are written to your disk.

  2. Code is transferred directly into the COBOL Editor, available in an add-on product.

If Screens is invoked from within the COBOL Editor, generated code is automatically modified and transferred back into the COBOL Editor for you to work with. The general rule in this situation is that all copyfiles are still written to the disk but the master source file is transferred to the COBOL Editor.

Generate Data Descriptions

Generates the Screen Section code for the form. You can then include this file in your program. The file has the extension .ss.

Generate Index Program

Generates an entire COBOL program based on the form that you designed. The generated COBOL enables you to key data into the screen form. The data is then stored as records in an indexed sequential file . It is important that you only use the top 21 lines of the screen for your screen form. The index program requires the last four screen lines for its menus. No warning is given if you break this rule.

See the section Index Programs for information on how to use the index program with the code generated by this option.

Generate Skeleton Program

Generates a skeleton program to display your form and accept any input. This file has the extension .cbl. The program references two copyfiles; one has the extension .ss and contains the Screen Section definitions for your form, the other has the extension .wks and contains the Working-Storage Section entries. When finished, the code produced by this function can be checked and run.

Highlight Left Special Character

Enables you to specify one of the special characters displayed on the message line. These are the special characters. Pressing Ctrl+F3=char-left moves the highlighting one character to the left. If Scroll Lock is on, the highlighting remains stationary while the line of characters moves one character to the right. When the highlighting is over the special character you want to include in your form you should use the Select Special Character function. The currently highlighted special character, along with decimal and hexadecimal representations of its ASCII value, is shown next to the Ctrl+F5=select-char option on the menu.

Highlight Right Special Character

Enables you to specify one of the special characters displayed on the message line. These are the special characters. Pressing Ctrl+F4=char-right moves the highlighting one character to the right. If Scroll Lock is on, the highlighting remains stationary while the line of special characters moves one character to the left. When the highlighting is over the special character you want to include in your form, you should use the Select Special Character function. The currently highlighted special character, along with decimal and hexadecimal representations of its ASCII value, is shown next to the Ctrl+F5=select-char option on the menu.

Insert Line

Inserts a line at the current cursor position. The lines below the cursor are moved down one line. If a line is inserted and the bottom line of the screen contains text, the bottom line is lost because a form can be no longer than 25 lines. If the bottom line contains any fields, the line is not inserted; you must first delete the field definitions. You cannot insert a line in the middle of a group.

Load File

Enables you to load previously saved screens, as well as forms produced by Forms and Forms-2 utilities.

You can load a file at program initialization by specifying a filename when invoking Screens. See the section Invoking Screens for more information.

Files created with Forms-2 must have the file extensions .s00 and .s01 for text and data, respectively. You cannot load files with the extensions such as .s02 and .s03.

Mark Block

Enables you to create a block for use with other functions from the Screens main menu such as Define Field, Define Group, Paint Attribute, Cut to Block and Copy to Block. Applying one of these functions to a block you have marked results in the function being applied to the marked area.

The marked area is shown in a reverse video attribute. Moving the cursor using the <left-arrow>, <right-arrow>, <up-arrow> <down-arrow>, Tab, Backtab, Home and End keys extends or contracts the marked area in a rectangular fashion from the original marked position.

The Mark Block function is a toggle; pressing F2=mark/unmark once starts to mark an area, pressing F2=mark/unmark again cancels the mark operation.

If you are displaying text in a Double-Byte Character Set (DBCS), when you mark a block over the first byte of a double-byte character, the character might appear corrupt until you mark the second byte.

Mark Fields

Displays the Mark Fields menu which is described in the section Menus. For a description of the functions available on this menu see the sections Mark Prime Key, Mark First Alternative Key, Mark Second Alternative Key, Mark Third Alternative Key and Unmark Key.

Mark First Alternative Key

Marks the field containing the cursor as the first alternate key. The field is highlighted with the number 1.

Index keys must be assigned in numerical order; that is, prime,
alternate 1, alternate 2, alternate 3.

Mark Prime Key

Marks the field containing the cursor as the prime key. The selected field is highlighted with the letter P.

Index keys must be assigned in numerical order; that is, prime,
alternate 1, alternate 2, alternate 3.

Mark Second Alternative Key

Marks the field containing the cursor as the second alternate key. The field is highlighted with the number 2.

Index keys must be assigned in numerical order; that is, prime,
alternate 1, alternate 2, alternate 3.

Mark Third Alternative Key

Marks the field containing the cursor as the third alternate key. The field is highlighted with the number 3.

Index keys must be assigned in numerical order; that is, prime,
alternate 1, alternate 2, alternate 3.

Paint Attribute

Assigns the current attribute to the current cursor position. If the cursor is currently positioned on a field or group, then the entire field and its occurrences (if they are in a group) are painted with the selected attribute. If the Mark Block function is currently active, the entire marked area is painted. You can change the current attributes available by using the Attribute Selection function.

If you are displaying text in a Double-Byte Character Set (DBCS), when you paint attributes on the first byte of a double-byte character, the character might appear corrupt until you paint the second byte.

Paste Block

The marked block is pasted to the screen in its current position. You are returned to the Screens main menu. You cannot paste a block in an area defined as a field or one having a group definition. See the section Mark Block for information on marking a block for use with this function.

Read Attribute

Selects the attribute at the current cursor position as the current attribute. If the word Attribute is displayed on the information line, it changes to show the new current attribute. The attribute read using this option replaces the previous attribute as a roll attribute.

Read Character

Selects the character at the current cursor position as the current special character. Subsequent use of the Select Special Character function results in the display of this special character.

Repeat Group Horizontally

Repeats the marked group to the right, as long as there is sufficient space and no other data fields would be overwritten. If the group contains input fields, the direction of the initial repeat specifies the manner in which data is accepted into the group. If the first repeat is horizontal, fields in the group are accepted row by row, from left to right.

To change the acceptance manner for a group from horizontal to vertical, you must delete repeating occurrences (using the Delete Group Horizontally function) then expand the group again. The information line displays an H to indicate that the acceptance manner of the group is horizontal.

The information line displays H to indicate the acceptance manner of the group.

Repeat Group Vertically

Repeats the marked group downwards, as long as there is sufficient space and no other data fields would be overwritten. If the group contains input fields, the direction of the initial repeat specifies the manner in which data is accepted into the group. If the first repeat is vertical, fields in the group are accepted column by column, from left to right.

To change the acceptance manner for a group from vertical to horizontal, you must delete repeating occurrences (using the Delete Group Vertically function) then expanded the group again.

The information line displays V to indicate that the acceptance manner of the group is vertical.

Restore Block

Retrieves the contents of a stored block from a stack of stored blocks. Blocks are stored using the Store Block function. See the section Store Block for information on storing blocks.

This function restores the last stored block and displays it in the temporary buffer which is visible on the screen.

Save File

Displays the Save menu (described in the section Menu earlier in this chapter), enabling you to save screens.

Screen Name

Enables you to assign a name to your screen. If you do not specify a screen name, a name prefixed by "G- " is assigned by the system.

Screen to Editor

Transfers an ASCII image of your form back into the COBOL Editor, leaving Screens and transferring you to the COBOL Editor. If the current form has changed since it was last saved, the following prompt appears:

Exit without saving? Y/N

Pressing Y or y transfers the form to the COBOL Editor, abandoning any changes made since the form was last saved. Pressing N or n leaves the current form unchanged, abandoning the request to transfer the form to the COBOL Editor.

This function only works if you invoked Screens from the COBOL Editor. To invoke Screens from the COBOL Editor, select Ctrl+F6=draw/forms from the COBOL Editor main menu, followed by F7=screens.

Select Attributes

Cycles through the five roll attributes. The word Attribute on the information line is shown in the currently selected attribute.

See the sections Set Roll Attribute One, Set Roll Attribute Two, Set Roll Attribute Three, Set Roll Attribute Four, Set Roll Attribute Five for information on setting the roll attributes.

Select Field Clause

Selects or deselects the currently highlighted clause in the popup menu. > and < are used to highlight the current clause. Move up and down the clauses using<up-arrow> and <down-arrow>. The following clauses appear in the popup:

Field name
AUTO
FULL
PROMPT
REQUIRED
NO ECHO
ZERO FILL
BLANK WHEN ZERO
JUSTIFIED RIGHT
SIZE
BELL
TO
FROM
USING

See the section Screen Section Clauses later in this chapter for descriptions of the effects of setting the above clauses.

Selecting Field name, PROMPT, SIZE, TO, FROM or USING results in the display of a further prompt for the additional information. Failure to enter text for these clauses results in the generation of data identifiers for the missing entries at generation time. If literals are required for assignment, you must include them at the prompt.

Using this function on a clause that is already selected deselects that clause.

Select Group Clause

Selects or deselects the currently highlighted clause in the popup menu. > and < are used to highlight the current clause. Move up and down the clauses using<up-arrow> and <down-arrow>. The following clauses appear in the popup:

Group-name
AUTO
FULL
PROMPT
REQUIRED
NO ECHO
ZERO FILL

See the section Screen Section Clauses later in this chapter for descriptions of the effects of setting the above clauses.

Selecting Group-name or PROMPT results in the display of a further prompt for the additional information.

Using this function on a clause that is already selected deselects that clause.

Select Special Character

Displays the special character you have selected using Highlight Left Special Character and Highlight Right Special Character functions. The character appears in the current attribute setting. The highlighted character is shown next to this menu option, with its decimal and hexadecimal ASCII values.

Set Character Attribute

Changes the character attribute by cycling through the five roll attributes. Erasing a line drawing character actually replaces the character with a space in the default attribute. If you have changed the current attribute between drawing a line and erasing it, the space is drawn in the current attribute, not the attribute used when the character was drawn.

Set Clear Screen Mode

Selects whether or not to generate code to clear the screen before the screen is painted. The selected state is highlighted. The initial state for this is off.

This toggle is not used by the code generated by the Generate Index Program and Generate Skeleton Program functions, only having an effect on the Generate Data Descriptions function.

Set Default Attribute

Installs the attribute at the current cursor position on the message line as the default attribute. All characters on your form that use the previous default attribute change to use the new default attribute. This function is useful for changing the attributes of a whole form.

Set Drawing Mode

Specifies the mode of operation, one of Draw, Erase or Move. The active mode is highlighted, and also displayed on the information line. In Draw mode, moving the cursor (using <left-arrow>, <right-arrow>, <up-arrow> and <down-arrow>) causes a line to be drawn. In Erase mode, moving the cursor causes any line at the cursor position to be replaced with a space in the current attribute. Move mode enables you to move the cursor around the screen without affecting the display. The initial setting is draw mode, as shown in Figure 9-9 in the section Draw Menu earlier in this chapter.

Set Field Order

Enables data to be accepted in a sequence different other the standard order; that is, top-to-bottom, left-to-right. If the field order is not specified, the default specifies that the fields on the first line are accepted first in a left-to-right order, followed by the fields on the second line in a left-to-right order, down to the fields on the bottom line in a left-to-right order.

The priority of a field is denoted by its accept order character. You can assign an accept order character to a field, denoting the field's priority when being accepted. Valid field order characters are 0-9, A-Z and a-z, where field order 0 has the highest priority, and z the lowest. So, fields with field accept order character 0 are accepted first, followed by all fields with accept order character 1, down to fields with accept order character z. Fields with equal acceptance order characters are accepted from top left to bottom right in a left-to-right manner.

When you press F10=field-order, the fields on the screen are replaced with the number 5 (or their previously assigned accept order characters). To change the accept order of a field, move the cursor to a field and enter a valid accept order character. The field is replaced with the new character and the field's accept order is changed.

When a group is displayed, only the original fields (containing the accept order characters) of the group definition are displayed. When the code is generated for the new field orders, the group is accepted in its entirety. It is not possible to accept part of a group. If a group is two dimensional, then the horizontal or vertical order is determined by the order in which the group was first repeated.

Press F10=field-order again to return to normal data entry mode.

You can alter field sizes by positioning the cursor in the field and pressing the Del key (to reduce the size) or by turning on insert mode (Ins) and typing caret characters (to increase the size).

Set Field Type

Specifies whether the field is numeric or alphanumeric. The default is alphanumeric. Pressing F4=numeric/alphanumeric toggles between the two states. A numeric field is denoted by 9s, whereas an alphanumeric field is denoted by Xs.

Set IDX Mode

Enables those users with add-on products to select between two versions of the generated index program. The IDX version relies purely on the Screen Section in COBOL to perform its task (including displaying help), whereas the advanced-IDX makes use of features of add-on products. Using advanced-IDX, the index program has better help screen displays, and an additional function F2=directory to help you load index files.

The selected state is highlighted. If you are not using an add-on product the initial state for this toggle is IDX; whereas if you are using an add-on product the initial state is advanced-IDX.

Set Line Mode

Selects whether to draw single or double lines. Pressing F3=single/double toggles between single and double, the current selection being highlighted. The initial setting is single.

Set Monitor Type

Selects whether the code generated for the painted form is more suitable for a color or monochrome display. The current state of this option is shown highlighted. The initial setting is for color.

This toggle is ignored by the code generated by both the Generate Skeleton Program and Generate Index Program functions, only having an effect on the Generate Data Descriptions function.

Set Roll Attribute Five

Installs the attribute at the current cursor position on the message line as the fifth of the five roll attributes. Use the Attribute Selection function to display the available attributes on the information line.

Set Roll Attribute Four

Installs the attribute at the current cursor position on the message line as the fourth of the five roll attributes. Use the Attribute Selection function to display the available attributes on the information line.

Set Roll Attribute One

Installs the attribute at the current cursor position on the message line as the first of the five roll attributes. Use the Attribute Selection function to display the available attributes on the information line.

Set Roll Attribute Three

Installs the attribute at the current cursor position on the message line as the third of the five roll attributes. Use the Attribute Selection function to display the available attributes on the information line.

Set Roll Attribute Two

Installs the attribute at the current cursor position on the message line as the second of the five roll attributes. Use the Attribute Selection function to display the available attributes on the information line.

Show Previously Saved Screens

Uses the Directory facility to display all the forms that have been previously saved.

Store Block

The marked block is erased, and placed into a first in, last out stack. You can use the Restore Block function to restore the blocks saved in this way. You can store up to 16 blocks.

Unmark Key

Removes the index key mark (prime or alternate) from the field containing the cursor.

9.2.5 Screen Section Clauses

This section lists the Screen Section entries found on the popup menus on both the Field and Group Properties menu screens. They are listed in alphabetical order. For further information on how to use these clauses, see your Language Reference. For more information on the Field and Group Properties menus, see the sections The Field Menu and The Group Properties Menu.

AUTO

Selecting the AUTO option causes the AUTO clause to be included in the Screen Section of your program. This clause causes an ACCEPT operation on the screen item to be terminated automatically when a character is keyed at the last character position, if there are no further fields on the screen; otherwise it skips automatically to the next field.

BELL

Selecting the BELL option causes the BELL clause to be included in the Screen Section of your program. This clause causes the alarm to sound each time the field is displayed.

BLANK WHEN ZERO

The BLANK WHEN ZERO option causes the BLANK WHEN ZERO clause to be included in the Screen Section of your program. This clause causes a field to be blanked out if it contains only zeros.

FROM

The FROM option causes the FROM phrase to be included in the Screen Section of your program. This phrase results in the initial value of the field on the screen being taken from the identifier or literal specified with the FROM phrase.

FULL

The FULL option causes the FULL clause to be included in the Screen Section of your program. This clause results in an ACCEPT of that field requiring the field to be full or empty.

JUSTIFIED RIGHT

The JUSTIFIED RIGHT option causes the JUSTIFIED RIGHT clause to be included in the Screen Section of your program. This clause results in data entry during an ACCEPT operation being right-justified in the field.

NO ECHO

The NO ECHO option causes the NO-ECHO clause to be included in the Screen Section of your program. This clause results in any ACCEPT of that field not displaying the entered characters. This is often used for password entry.

PROMPT

The PROMPT option causes the PROMPT clause to be included in the Screen Section of your program. This clause fills the field prior to an ACCEPT operation. When you select this option, you are prompted to enter a name. This name can either be a literal within quotes or a data name.

REQUIRED

The REQUIRED option causes the REQUIRED clause to be included in the Screen Section of your program. This clause results in an ACCEPT of this item requiring that the field not be empty.

SIZE

The SIZE option causes the SIZE clause to be included in the Screen Section of your program. This clause overrides the size specified by the number of carets in the field position. If the size is different from the number of carets in that field position than when the COBOL code is generated, the smaller size is used for accepting that field. If an identifier is specified with the SIZE clause, the size of the field can be dynamically altered at run time by the COBOL program.

TO

The TO option causes the TO phrase to be included in the Screen Section of your program. This clause results in the accepted field being placed into the field defined after the TO entry.

USING

The USING option causes the USING phrase to be included in the Screen Section of your program. This phrase causes the entry to be used as both a sending and a receiving area. Note that USING and TO are mutually exclusive, as are USING and FROM. However, TO and FROM can be used together or independently.

ZERO FILL

The ZERO FILL option causes the ZERO-FILL clause to be included in the Screen Section of your program. This clause results in the replacement of trailing prompt characters by zeros instead of spaces. This clause is valid only with numeric fields.

9.2.6 Skeleton Program

The following skeleton program was generated from the sample form created in the chapter Using Screens. It was then syntax-checked using the Compiler.

The variables in the code, in addition to the system drive and pathname, are due to the exact location of the fields on the screen and the attributes set for the fields, and as such could be different to any names you generated.

001 identification division.
002 data division.
003 working-storage section.
004 copy "myform.wks".
005 01 order-name pic x(12).
006 01 filler
007     03 occurs 5.
008         05 order-addr pic x(18).
009 01 order-tel-no pic x(7).
010 screen section.
011 copy "myform.ss".
012 01 g-myform.
013     02 blank screen.
014     02 line 1 col 6 background-color 0 foreground-color 7
015          highlight pic x(12) using order-name  auto.
016     02 line 5 col 9.
017     02 g-001.
018         03 occurs 5.
019             04 pic x(18) using order-tel-no auto.
020             04 line + 1 col - 17.
021     02 line 1 col 51 pic x(7) using order-tel-no auto.
022     02 line 1 col 1 foreground color 1 highlight
023                                 value "Name:".
024     02 col 44 value "Tel No:".
025     02 line 5 col 1 value "ADDRESS:"..
026     02 line 13 col 28 highlight value "WARNING".
027     02 line 14 col 28 highlight value "MESSAGE".
028 procedure division.
029     display g-myform
030     accept g-myform.
031     stop run.

9.2.7 Index Programs

Screens also lets you generate an entire COBOL program based on a form that you design. The program that is generated allows you to key data into the form. The data is then stored as records in an indexed sequential file.

An indexed sequential file is a data file for which an alphabetic index is automatically maintained. The index is based on a key that you specify on your form. This key consists of one or more fields that you specified when you created the data area of your form. For example, if you design a form to hold information about names and telephone numbers, you may want to mark the NAME field as the key. This enables you to access records in alphabetical order by name. In addition to storing data, the index program lets you recall any record from disk, change or delete records, and conduct an alphabetical search through the file regardless of the order in which the records were entered.

The index program created using Screens lets you key data into a form. This data is then stored as records in an indexed sequential file. You can change, delete and add records to this file.

The order in which records are positioned in the index depends on the collating sequence of this COBOL system. For most business applications, the significant characters in the sequence are alphabetic characters. However, all 256 characters can be used in a file; this is why the collating sequence is important.

The design and implementation of the options available when running an Index program are patterned after the COBOL Indexed Sequential Access Method (ISAM). The options used to open files and the commands available for accessing records are those used in the COBOL language.

9.2.7.1 Generating an Index Program

To generate an index program you must perform the following steps:

  1. Invoke Screens (see Invoking Screens described earlier).

  2. Either design a new form or load a form you created earlier.

  3. With the form loaded into Screens, you must mark the index key. This specifies the fields that the index program is to treat as the key.

  4. Press Alt+F5=generate-COBOL from the Screens main menu, and enter the name of the program to be generated. The Generate-COBOL menu appears on your screen. This is the same menu you used to generate data descriptions and skeleton program statements for your program source code.

  5. Press F5=index-program to generate the index program.

If you have forgotten to select an index key, the following message is displayed:

Incorrect index sequence

If this message is displayed you must use the F7=mark-fields option from the Generate-COBOL menu to correctly define the keys.

If you have not assigned a name to any of the index key fields, the following message is displayed:

Index field not named

If this message is displayed you must use the F3=field option from the Screens main menu to specify a data-name for the TO, FROM or USING clause.

When Screens is generating the index program, the code being generated scrolls up in the menu area.

What happens when Screens finishes generating the index program depends on whether you are using an add-on product:

9.2.7.2 Preparing the Index Program

You now compile, link and run the Index Program, as described in the chapter Developing COBOL Applications in your Object COBOL User Guide.

When you run the index program, the form design is displayed on the screen. The Index Program menu shown in Figure 9-19 is displayed, with the filename MYPROG displayed as an example.



Figure 9-19: The Index Program Menu

When you press Enter to run the index program using the file at the File prompt, the Automatic Mode menu is displayed. This menu is described in the following sections.

9.2.7.2.1 Moving Through the Form

You can use several keyboard keys to move through the form as you enter data. These same keys are used in the COBOL Editor; however, they function in a slightly different manner when used with the Index program. All of them are available in both Manual and Automatic mode.

Key or Mouse Movement
Effect
<left-arrow> Moves the cursor one character position to the left.
<right-arrow> Moves the cursor one character position to the right.
Home Moves the cursor to the beginning of the first field on the screen.
Ctrl+Home Clears the contents of all fields from the screen.
Tab Moves the cursor to the beginning of the next field.
Backtab Moves the cursor to the beginning of the current or previous field.

9.2.7.3 Index Program Operation Menus

This section shows the menus you might encounter when running the index program.

9.2.7.3.1 Automatic Mode Menu

The Automatic Mode menu is displayed when you have selected Automatic mode using the Set Program Mode function. This menu is displayed in Figure 9-20.



Figure 9-20: The Automatic Mode Menu

The Automatic Mode menu displays options which enable you to perform the following actions:

You can perform other actions in Automatic mode but they are not selected from a menu. See the section Index Program Functions for descriptions of functions you can use.

9.2.7.3.2 Manual Mode Menu

The Manual Mode menu is displayed when you have selected Manual mode using the Set Program Mode function. This menu is displayed in Figure 9-21.



Figure 9-21: The Manual Mode Menu

The Manual Mode menu displays options which enable you to perform the following actions:

9.2.7.4 Index Program Functions

This section describes the functions that are available from the Manual Mode and Automatic Mode menus. Where a function is only available in one of the modes this is highlighted.

The functions are listed in alphabetical order.

Delete

Pressing F9=delete deletes the record whose key is the same as the displayed key value. The current record pointer is left unchanged.

When the operation is complete, the word Successful appears on the message line. If the operation is not successful, the appropriate message appears instead.

Automatic:
The Delete function is not available in Automatic mode.

Read-key

Reads the record whose key is the same as the displayed key value. If such a record does not exist the current record pointer is undefined.

Automatic:
In Automatic mode you access the Read-key function by pressing Enter when you have entered the key field of the record to be read.

Manual:
In Manual mode you access the Read-key function by pressing F5=read-key when you have entered the key field of the record to be read.

Read-next

Reads the record at the current record pointer. If this record has already been read, the next record is read, and the current record pointer is updated.

Automatic:
In Automatic mode, pressing Enter when no changes have been made to the key and data fields accesses the Read-next function.

Manual:
Pressing F6=read-next accesses the Read-next function.

Rewrite

Pressing F8=rewrite replaces the record whose key is the same as the displayed key value. The current record pointer is left unchanged.

The Rewrite function is useful for changing existing data.

Automatic:
The Rewrite function is not available in Automatic mode.

Select Alternate Index Key

Pressing Shift+F10 selects an alternate index key. If no alternate indexes were marked when the index program was generated, this option is not available. A submenu is displayed enabling you to use F2, F3, F4 and F5 to view and change the alternate keys.

Automatic:
The Select Alternate Key Index function is not available in Automatic mode.

Set Program Mode

Pressing F10=manual/auto toggles between the two modes of operation: manual and automatic. The default is automatic.

Start=

Pressing F2=start= sets the current record pointer to that of the displayed key value. If this value does not exist in the file, the current record pointer is undefined.

Automatic:
The Start= function is not available in Automatic mode.

Start>=

Pressing F3=start>= sets the current record pointer to that of the displayed key value. If a record with a key equal to the displayed key value does not exist, the current record pointer is set to the record whose key is closest to, but not less than, the displayed key value.

Automatic:
The Start>= function is not available in Automatic mode.

Start>

Pressing F4=start> sets the current record pointer to the record whose key is closest to, but not less than, the displayed key field.

Automatic:
The Start> function is not available in Automatic mode.

Write

The current cursor position is the first character position in the first key field on the screen. To begin entering data into the fields, type the data into the first field on the screen. When you reach the end of one field, the cursor automatically moves to the beginning of the next field if there is one. When you reach the end of the last field on the screen, the system beeps.

Continue entering data until you have entered data in all of the desired fields on the screen. Then press F7=write to store the screen display as a record. The message at the bottom of the screen indicates whether the write was successful.

After writing the record, the cursor automatically moves back to the first field on the screen. You can then begin entry of another record.

Automatic:
Access the Write function in Automatic mode by pressing Enter when you have entered the data for the new record.

Manual:
Access the Write function in Manual mode by pressing F7=write when you have entered the data for the new record.

9.2.8 Error Messages

The following is an alphabetical list of error messages that you might encounter when using Screens.

Block stack full

You have tried to store a block when the stack for storing blocks is full. The maximum number of blocks that can be stored is 16.

Clear without saving? Y/N

You have tried to clear the screen without saving the current form.

Cut/Copy without paste? Y/N

You have tried to exit from the Block menu without pasting, copying or storing the visible block.

Data on bottom line

You have tried to insert a line above a field or group on the 25th line.

Data on line

You tried to delete a line that contains a field or a group.

Error closing file

A disk error occurred when Screens tried to close the file.

Error creating file

A disk error occurred when Screens tried to create a file. Possible reasons for this include the disk being full, or the failure to find the specified disk.

Error opening file

The file specified could not be found.

Error reading file

Possible disk error. Possible causes for this include the disk being corrupt or the file being locked.

Error writing file

Disk error. Possible causes for this include the disk being full or the file being locked.

Exit SCREENS. Are you sure? Y/N

You have requested to exit Screens. Pressing Y or y exits Screens.

Exit without saving? Y/N

You have requested to exit Screens without saving a form. Press Y or y to exit Screens without saving the form.

Field definition overlap

You have tried to define a field overlapping an existing field.

Field not marked

You have tried to unmark a key field that had not been marked.

Field table full

You have exceeded the limit for the maximum number of data entries a screen can contain. This limit is 200.

File already exists. Overwrite? Y/N

You have tried to work with a file that already exists.

File not found

You have specified a file that Screens cannot find.

Generate without saving?

You have tried to generate COBOL for a form that has changed since it was last changed.

Group area

You have tried to change the size of a field in a group. This is not allowed. You must first delete the group definition.

Group definition overlap

You have tried to define one group in such a way that it would overlap another.

Group nesting not allowed

You have tried to define a group within a group. This is not allowed.

Illegal order character

You have specified an accept order character that is not in the correct range. Valid characters are 0-9, A-Z and a-z.

Incorrect index sequence

You have tried to define keys for a form in the wrong order. You must define keys in the following order:

  1. Prime.

  2. Alternate key 1.

  3. Alternate key 2.

  4. Alternate key 3.
Index field not named

You have tried to generate an index program where a key field does not have a user-defined name. Assign the field a name using the FROM, TO or USING Screen Section clauses.

Internal heap error

System error. Reboot your machine to free any memory. If this error still occurs after rebooting, contact Technical Support who will try to help you to discover the cause of the error.

Invalid delete

You have tried to delete a field that is part of a group. You must first delete the group definition.

Invalid field definition

You have tried to define a field when the cursor is not on a marked block or a caret.

Invalid function

System error. Contact Technical Support who will try to help you to discover the cause of the error.

Invalid group definition

You have tried to define a group that is invalid. A marked area must be active and must not split any fields or include any existing group definitions. The area must contain at least one field.

Invalid insert

You have tried to insert a character at the cursor position when there is a field definition blocking the way.

Invalid mark

You have selected a function that is not valid for the block you have marked.

Load fail

Screens was unable to load the file you specified, possibly because it was unable to read the disk.

Load without saving? Y/N

You have asked to load a form when the current form has changed since it was last saved. Continue to load the new form will lose the changes you have made to the current form since you last saved it.

Mark index fields first

You have tried to generate an index program without marking any index fields.

No block defined

You have not specified a block for a function that requires one.

No block to restore

You have tried to restore a block when you have not previously saved any blocks.

No field definition

You have tried to delete a field that does not exist.

No field in group definition

You have tried to define a group but the marked area does not contain at least one field.

No occurs

You have tried to delete an occurrence of a group when there is only one occurrence of the group on the form.

Non-existent field

You have tried to enter an accept order character when the cursor is not on a field.

Set lesser keys first

You have tried to mark a key field out of numerical order. The prime key must be defined first, followed by the three alternate keys in numerical order.

Protected area - field

You have tried to overwrite a field. This is not allowed.

Save fail

Screens was unable to save the file you specified, possibly because of a disk error.

Not a valid index key

You have tried to mark a key that is not an elementary item.

Screen limit reached

You have reached the last row or column on the screen.

Unknown file format

You have specified file format that is not recognized, resulting in a load failure.

Unknown error code

An undefined system error has occurred. Contact Technical Support who will try to help you to discover the cause of the error.


Copyright © 1999 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.

PreviousMouse Support for Character Interfaces Using ScreensNext"