The INPUT sub-dialog
The INPUT sub-dialog implements single record input in fields of the
current form.
Program variable to form field binding
Each record member variable is bound to the corresponding field of a screen record, in order to manipulate the values that the user enters in the form fields.
The INPUT clause
can be used in two forms:
INPUT BY NAME variable-listINPUT variable-list FROM field-list
The BY NAME clause implicitly binds the
fields to the variables that have the same identifiers as the
field names. The variables must be declared with the same names as
the fields from which they accept input. The runtime system
ignores any record name prefix when making the match. The unqualified
names of the variables and of the fields must be unique and
unambiguous within their respective domains. If they are not, the
runtime system generates an exceptions, and sets the STATUS variable
to a negative value.
DEFINE p_cust RECORD
cust_num INTEGER,
cust_name VARCHAR(50),
cust_address VARCHAR(100)
END RECORD
...
DIALOG
INPUT BY NAME p_cust.*
BEFORE FIELD cust_name
...
END INPUT
...
END DIALOG The FROM clause explicitly binds the fields in the screen record to a list of
program variables by position. The number of variables or record members must equal the number of
fields listed in the FROM clause. Each variable must be of the same (or a
compatible) data type as the corresponding screen field. When the user enters data, the runtime
system checks the entered value against the data type of the variable, not the data type of the
screen field.
DEFINE c_name VARCHAR(50)
c_addr VARCHAR(100)
...
DIALOG
INPUT c_name,
c_addr
FROM FORMONLY.field01,
FORMONLY.field02
BEFORE FIELD cust_name
...
END INPUT
...
END DIALOGIdentifying an INPUT sub-dialog
The name of an INPUT sub-dialog can be used to qualify sub-dialog actions with a prefix.
In order to identify the INPUT sub-dialog
with a specific name, you can use the ATTRIBUTES clause
to set the NAME attribute:
INPUT BY NAME p_cust.*
ATTRIBUTES (NAME = "cust")
... Control blocks in INPUT
Simple
record input declared with the INPUT sub-dialog can
raise the following triggers:
In the singular INPUT instruction, BEFORE INPUT and
AFTER INPUT blocks are typically used as initialization and
finalization blocks. In an INPUT sub-dialog of a
DIALOG block, BEFORE INPUT and AFTER
INPUT blocks will be executed each time the focus goes to
(BEFORE) or leaves (AFTER) the group of fields
defined by this sub-dialog.