The INPUT statement
The INPUT
statement allows the user to enter or change the values in
a program record, which can then be used as the data for new rows in a database table, or to
update existing rows.
In the INPUT
statement you must bind program variables to form fields. When
program variable names do not match the form field names, you must use the following syntax:
INPUT program-variables FROM
form-fields
The FROM
clause explicitly binds the fields in the screen record to the program
variables, so the INPUT
instruction can manipulate values that the user enters in
the screen record. The number of 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.
INPUT
supports also the BY NAME
clause, when form fields have
the same names than the program variables. If a record variable defines members that match form
fields, use the .*
notation as shortcut for all fields:
INPUT BY NAME record-variable.*
When invoked, the INPUT
statement enables the specified fields of the form in
the current form, and waits for the user to supply data for the fields. The user moves the cursor
from field to field and types new values. Each time the cursor leaves a field, the value typed into
that field is deposited into the corresponding program variable. Within the INPUT
instruction, you can implement control blocks of code such as BEFORE FIELD
and
AFTER FIELD
that will be called automatically during the dialog, so that you can
monitor and control the actions of your user within this statement.
The INPUT
statement ends when the user selects the accept
or cancel actions.