A SERVICE OF

logo

296 Chapter 4
Command Definition F-K
INPUT
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
...
ENDWHILE
Table 4-2 illustrates how the INPUT command functions.
Table 4-2 INPUT Command Function
* The result is an error if the user responds with an unquoted string:
INPUT BLEEP,>
>ABC Return
SETVAR BLEEP !BLEEP
ABC is not a number. And, without quotes around it, ABC is not a string, either. If ABC is not
a defined variable, it has no value to extract. So, the attempt to evaluate the result of
explicitly dereferencing, !BLEEP produces an error. Refer to the SETVAR command.
Related Information
Commands DELETEVAR, SETVAR, SHOWVAR, INPUT( ) function
Manuals Using the HP 3000 Series 900: Advanced Skills (31126A Opt. 002)
INPUT bleep and the user
responds with:
What is stored in bleep: Value* of bleep after SETVAR
bleep !bleep:
001 001 1 (integer)
“001“ “001“ 001 (string)
TRUE TRUE TRUE (Boolean)
9+3 9+3 12 (integer)
Return (null) or bleep is not modified
if it already exists
<<error from the parser>>