FIELD STATEMENT IN FORM LAYOUTS

FIELD specifies a data field for the form.  This statement may be repeated for more data fields to be included in the form.  Each FIELD statement may have the following substatements:  ID, EXIT, PICTURE, DATE FORMAT, PERFORM, and HELP.  These substatements are described on the following pages.

A system field, a Global Storage (GS) field, a Declare Section field, a field from a Data Set (DS), or a field from a ready area can be specified.  This statement associates the field that was specified with an area on the screen where the field is entered or displayed.

The order of the FIELD statements within the LAYOUT SCREEN definition is significant.  The FILL statement/command processes the FIELD statements in the order in which they are defined, not in the order that they appear on the screen.  If the data field is the second FIELD statement in the LAYOUT SCREEN definition, it is processed second.

SYNTAX

/FIELD row column width rendition field_name display_type

row

is an integer constant that specifies the row position where the data item begins in the form.

column

is an integer constant that specifies the column position where the data item begins in the form.

width

is an integer constant that specifies the number of columns the data item occupies.

rendition

specifies the video attributes for the data item.  More than one video attribute may be specified by separating the attributes with plus signs.

 

The valid video attributes are:

  • @NORMAL specifies normal video attribute.  [default setting]
  • @BLINK specifies blinking video attribute.
  • @BOLD specifies bold face video attribute.
  • @REVERSE specifies reverse video attribute.
  • @UNDERLINE specifies underlining video attribute.

field_name

specifies the name of the data field associated with the data entry area.  Any system field, GS field, or user-defined field can be specified.  If the form operation is performed in a Process Module (PM), the user-defined field can be any field from the Declare Section, related data sets, or a ready area.  All components of the field name can be specified.

field_name:designator:R

If the field is subscripted, all subscripts must be specified.

display_type

specifies whether the field is modifiable.  Valid values are: 

  • ENTER indicates that when the cursor is moved to this field the first time, a new value should be entered.  After the value is entered, the display type of the field is set to CHANGE and the values of the subsequent non-ENTER fields can be displayed.  The ENTER display type can be used for entering new data or accepting a key value for retrieval of associated information.
  • CHANGE indicates the value of the field is displayed first.  The value can either be changed or the cursor moved on to the next modifiable field.
  • SHOW indicates the value of the field is read only.  The value of the field is displayed and cannot be modified.  The cursor never stops at the field with this display type.  It is not recommended to design a form with all SHOW fields.
  • CHOICE is like SHOW, except that the cursor stops at a CHOICE field, unlike a SHOW field which the cursor skips.  The cursor remains in a CHOICE field and waits for "input".
 

Input can be:  one of the keys defined in @TERM_LIST, one of the arrow keys or one of the keys defined in:

  • @CANCEL_CODE
  • @HELP_CODE
  • @END_CODE
  • @REFRESH_CODE

If any other key is pressed, the terminal beeps.

 

The purpose of the CHOICE display type is to cause an action to take place when the user selects the field.  This makes it possible to have menu functions on forms in one window.  Since the CHOICE field is a data field, its value can be dynamically changed.

With this option, a field can be defined that the user can "choose".  The user chooses a field by pressing one of the keys in @TERM_LIST.  Forms can be designed where the user can choose from a list such as is done with the SMF menus without doing a separate menu layout window for it.

DEFAULT indicates that the display type of this field can be changed to ENTER, CHANGE, or SHOW by the FILL statement/command.  This allows a single form to be used for different purposes.  DEFAULT is the default display type and does not need to be specified.

EXAMPLE

Basic Enter, Show, and Change Fields

/FIELD 2 10 10 @NORMAL EMP_CODE ENTER

/FIELD 2 40 10 @NORMAL DATE SHOW

/FIELD 4 10 40 @NORMAL EMP_ADDRESS CHANGE

The above example shows three data fields defined for the form.  The first data item starts at row 2 and column 10 in the form.  The data item has a width of 10 columns with a normal rendition.  The associated field name is EMP_CODE.

The second data item starts at row 2 and column 40 in the form with normal rendition.  The associated field name is DATE.

The third data item starts at row 4 and column 10 in the form with normal rendition.  Its associated field name is EMP_ADDRESS.

During the form operation, the cursor is first pointed at the EMP_CODE data item, the data area (row 2 and column 10 through row 2 and column 19) is cleared, and ACCENT R prompts for the data item to be filled in.  After the data is entered, the cursor moves to the second data item, DATE.  Since the display type of the field is SHOW, the current value of DATE is displayed and the cursor moves on to the third data item, EMP_ADDRESS.  Since the display type of EMP_ADDRESS is CHANGE the current value in EMP_ADDRESS is displayed.  At this point, the current value of EMP_ADDRESS can be accepted or changed.

EXAMPLE:  CHOICE FIELDS AND @FILL_ACTION

This example shows how a menu can be displayed if the user presses the Return key when the cursor is positioned on the field.  A FORM field with a display type of CHOICE is defined.

LAYOUT SCREEN MAIN
/   FILL...
/        FIELD 10 55 17 @REVERSE CUST_SEARCH_MENU CHOICE
/            PERFORM CUST_SEARCH
LAYOUT END

The field is assigned the value "Customer Search".

CUST_SEARCH_MENU CHAR 17 DATA " Customer Search "

The FORM is compiled and displayed on the screen.

GENERATE MAIN TO MAIN_ID
FILL MAIN_ID

If the user enters one of the keys in @TERM_LIST while the cursor is positioned on the field, the CUST_SEARCH trigger is executed (which pastes the customer search menu).  The trigger associated with the item that the user selects will be executed next.

After the menu selection is made, a value (1 through 4) will be stored in @MENU_CHOICE, depending on the item chosen.  If the user selects the "Return" menu item (@MENU_CHOICE EQ 4), the menu is unpasted.  @FILL_ACTION is then set to "REDO" which causes SMF to redisplay the form with the cursor positioned on the customer search field.

The LAYOUT SCREEN definition of the menu is shown below.  There are PERFORM's for each of the menu items, except for the "Return" item which is checked in the CUST_SEARCH trigger below.

CUST_SEARCH_ID,INT,MAX
LAYOUT SCREEN CUST_SEARCH
/  MENU        13 56 5 20   @NORMAL
/  SELECTION          1 0   @REVERSE
/  BORDER
/
/  ITEM               1 1   @NORMAL ""
/   KEYWORD           1 1   @NORMAL " Select From List "
/   PERFORM SEL_LIST
/
/  ITEM               2 1   @NORMAL ""
/    KEYWORD          2 1   @NORMAL " Generic Search "
/    PERFORM GEN_SEARCH
/
/  ITEM               3 1   @NORMAL ""
/    KEYWORD          3 1   @NORMAL " Exact Match "
/    PERFORM EX_MATCH
/
/  LINE          4 1 4 19   @NORMAL
/
/  ITEM               5 1   @NORMAL ""
/    KEYWORD          5 1   @NORMAL " Return"
LAYOUT END
TRIGGER CUST_SEARCH
   GENERATE CUST_SEARCH TO CUST_SEARCH_ID IF &
       (CUST_SEARCH_ID EQ 0)
   SCREEN PASTE_WINDOW USING CUST_SEARCH_ID, 13, 56
       MENU CUST_SEARCH_ID
! After terminal input, if "Return" is selected...
       IF:10 (@MENU_CHOICE EQ 4)
! Unpaste the menu...
       SCREEN UNPASTE_WINDOW USING CUST_SEARCH_ID
! And move cursor back to "Customer Search" field
       "REDO" TO @FILL_ACTION\
   CONTINUE:10

Customer Search Menu

Figure 9 Customer Search Menu

"Customer Search" is a form field with a display type of CHOICE.  When the user moves the cursor to the field and presses the Return key the menu is pasted.

NOTE:  After the form is displayed on the screen, the display types of the data fields are scanned in the order in which they are specified in the LAYOUT SCREEN statement.  If the display type of the field is CHANGE or SHOW, its current value is displayed according to its format specification.  This process stops when an ENTER field is encountered.  If a CHANGE field comes before the first ENTER field, the cursor stops at the first CHANGE field.  Otherwise, the cursor stops at that ENTER field.  The user can then enter data or use the cursor keys to move to the next modifiable data field.  After the data has been entered into an ENTER field, the current values of all subsequent non-ENTER fields are displayed.  If there is a CHANGE field among those subsequent data fields, the cursor goes back to that field.  Otherwise, the cursor stops at the next ENTER field.

Record Fields cannot be used with the FIELD statement of a form layout in the Screen Management Facility (SMF).  The Record Fields are shown in Table 3.

@ADDRESS
@CF_NAME
@DI_NAME
@DOMAIN_NAME
@DS_NAME
@EOF
@ERR
@MATCHED
@NEW_RECORDS
@OMITTED
@QUALIFIED
@RECORD
@RECORDS
@RECORD_SIZE
@RN
@UNMATCHED
@UNQUALIFIED
@DELETED_RECORDS

Table 3 Record Fields

Back to Title Statement    Next page ID Substatement