Variables (KEYIN)
Variables within the KEYIN list retain information entered from the keyboard. Each character entered is echoed to the screen, unless specified to the contrary. The cursor is bumped one position to the right for each character entered, up to the maximum field size. A null entry indicates the enter key ([E]) was pressed without entering any data. Unless modified by a list control, variables are accepted as follows:
Character String Variables, Character String Array Elements, and Character String Arrays
Any key code from the keyboard which is not already defined as a Function key, Cursor key or other Special key may be entered into character string variable.
The number of characters entered cannot exceed the Physical Length.
If a Null String is entered, both the Form Pointer and Length Pointer is set to zero.
If data is entered, the Form Pointer is set to one (1) and the Length Pointer points to the last character entered.
If the enter key is pressed, processing continues with the next item in the list.
If an item within the list is a character string ARRAY and no specific array element has been specified, every array element is used.
Using a DIM 10 variable, the results of various KEYIN instructions are as follows:
|
|
| |||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Numeric Variables, Numeric Array Elements, and Numeric Arrays
Only valid numeric data is accepted for entry into a numeric variable. Upon pressing the enter key, the entered data is formatted to match the variable's data definition.
A minus sign is accepted if:
It is the first character entered.
There remains room for at least one digit before the decimal point.
A decimal point is accepted only if one is specified in the data definition.
Only one decimal point is accepted.
The number of digits that may be entered both preceding and following any decimal point is restricted to the specified data definition.
A null entry generates a value of zero.
Once the enter key is pressed, processing continues with the next item in the list.
If an item within the list is a numeric array and no specific array element has been designated, every array element is displayed.
Using a FORM 3.1 variable, the results of various KEYIN instructions are as follows:
|
Input |
Results | |
|
|
PL |
Contents |
|
[E] (null entry) |
5 |
.0 |
|
0 [E] |
5 |
.0 |
|
5 [E] |
5 |
5.0 |
|
25.2 [E] |
5 |
25.2 |
|
-5.8 [E] |
5 |
-5.8 |
See Also: Literals and Control Characters, KEYIN, List Controls (KEYIN and DISPLAY), List Controls (KEYIN Only), List Controls (Graphic Characters), Interactive I/O Instructions
![]() |