MPE/iX Commands Reference Manual (32650-90877)
246 Chapter7
Command List V
Commands HEADOFF thru LISTF
The user may optionally specify a timed read by creating a value for
seconds
. The pending
read prompt is canceled after
seconds
. The INPUT command recognizes the HPTIMEOUT
variable. The length of the timed read is
seconds
or HPTIMEOUT (in minutes), whichever is
smaller. If a timed read (using
seconds
or HPTIMEOUT) expires, then the pending read
terminates.
•If
varname
already exists and you enter a null (a Return), then the value of
varname
remains unchanged.
• The same thing happens if
varname
exists and
seconds
or HPTIMEOUT expires before a
value for
varname
is entered. In this case, however, a warning occurs, and CIERROR is
set to 9003.
•If
varname
does not exist and a null (a Return) is entered for the variable value, then
varname
is created and set to null (““).
•If
varname
does not exist and
seconds
or HPTIMEOUT expires, then
varname
is created
and set to null (““), and CIERROR is set to 9003.
• If the timed read expires due to the value of the HPTIMEOUT variable, for example,
HPTIMEOUT=1 (in minutes) and the user executes INPUT bleep,,65, then the session is
logged off.
Use
This command is available in a session, job, program, or in BREAK. Pressing
Break aborts
the execution of this command, without creating or modifying
varname
.
Examples
The INPUT command does not evaluate expressions, it stores them as a string. For
example, the command INPUT bleep accepts and stores input (
somevalue
). If you want
somevalue
treated as an expression and evaluated and the result assigned to bleep (as
opposed to assigning the string representation of
somevalue
), use the SETVAR command
after using the INPUT command:
INPUT bleep
SETVAR bleep !bleep
The first command reads whatever value you enter and sets bleep to the string
representation of that input. The second command assigns bleep the (evaluated) value
that you entered.
INPUT MYVAR <FILEONE
The above example reads the first record in FILEONE into the CI variable named MYVAR.
In order to read the entire contents of a file INPUT must be in a WHILE loop and the while
loop must have its $STDIN redirected to the file. Eg: READFILE <FILENAME , where
READFILE looks like:
SETVAR EOF FINFO(HPSTDIN, ‘EOF’)
WHILE SETVAR (EOF, EOF-1) >=0 DO
INPUT MYVAR
...