The $ENTER function provides efficient terminal dialogue with users of data entry applications.
The format of the $ENTER function is:
$ENTER (number of values, prompt string, default value, separator, name prefix)
$ENTER prompts the terminal operator with the value entered in the prompt string argument. If this argument is omitted, this prompt appears:
The operator enters a single line of input which is read by Model 204. This line is parsed into individual values using the value of the separator argument as the delimiter.
- The separator argument must be a single character. If it is omitted, a comma is used as the default separator. If an input value is longer than 255 characters, a warning message is issued and the value is truncated. The input values are assigned in the order of %variables using the value of the name prefix argument as follows:
- If the name prefix argument is omitted, the %variables are named %01, %02, %03, and so on. All %variable names generated by $ENTER must appear elsewhere in the request so that the variables can be allocated during compilation.
- The number of values argument is required; it indicates the number of values assigned by $ENTER. If any values are omitted, the value specified in the default value argument is assigned to the appropriate %variables. If the default value argument is omitted, a single blank character is the default.
%name prefix 01, %name prefix 02, %name prefix 03,...
If $ENTER completes successfully, it returns a value of 0. If it fails for any of these reasons, $ENTER returns a value of 1 and prints an explanatory message:
- Too many values are included on the input line.
- The number of values argument is less than 1 or greater than 99.
- Required %variables were not allocated during compilation (a %variable used in $ENTER does not appear elsewhere in the request).
Suppose a request contains the following function call:
%X = $ENTER(3, 'ENTER 3 VALUES', '99999' ,, 'ZZ')
The following prompt is displayed at the terminal:
ENTER 3 VALUES
The user enters:
$ENTER returns a value of 0. This result is equivalent to the following:
%ZZ01 = 'A1' %ZZ02 = '99999' %ZZ03 = 'C3'
%Y = $ENTER (4,,,'/',)
This default prompt is displayed:
The user enters:
$ENTER returns a value of 0, which is equivalent to:
%01 = 'ONE' %02 = 'TWO' %03 = 'THREE' %04 = 'FOUR'