HP 3000 Manuals

LINPUT [ HP Business BASIC/XL Reference Manual ] MPE/iX 5.0 Documentation


HP Business BASIC/XL Reference Manual

LINPUT 

LINPUT statement execution places the program in the input state and
assigns a string value obtained from the terminal or input file to a
single string variable.  The string value accepted is an unquoted string
literal.  Double quotes are characters.  Unlike the INPUT statement, the
LINPUT statement includes the leading and trailing blanks as part of the
string value.  Commas and semicolons are not recognized as item
separators or terminators, but are characters.  LINPUT also reads one
record of an ASCII file into a string variable.

Syntax 

     LINPUT [  prompt_option ] str_var LINPUT #fnum [, rnum]; str_var 

Parameters 

prompt_option    The LINPUT statement displays its prompt the same way
                 and under the same conditions as the INPUT statement.
                 See the prompt_option parameter under the INPUT
                 statement for more information.

str_var          A string variable.  An error occurs if the variable is a
                 string rather than a substring and the input string
                 value exceeds the string variable's maximum length.  If
                 the variable specified is a substring, and the input
                 string value exceeds its length, the input string value
                 is truncated on the right (no error occurs).  See
                 "Substring References" in chapter 3 for more
                 information.

fnum             The file number that HP Business BASIC/XL uses to
                 identify the file.  It is a numeric expression that
                 evaluates to a positive short integer.

rnum             Record number, a numeric expression.  A file I/O
                 statement that specifies rnum is direct; otherwise, it
                 is sequential.

Examples 

     05 B$= "Please enter A$ "
     10 LINPUT A$                    !Prints a question mark (?) and a carriage return.
     20 LINPUT PROMPT B$; A$         !Prints "Please enter A$"
     30 LINPUT PROMPT B$+": ", A$    !Print "Please enter A$ :" and a carriage return
     40 LINPUT "Enter A$: "; A$[1,3] !Prints "Enter A$:"

If the data from the record exceeds the maximum length of the string
variable, an error occurs if str_var is a string (rather than a
substring).  For example, an error occurs at line 140 of the following
sequence:

     120 DIM C$[8]
     130 PRINT #1,1; "more than eight"
     140 LINPUT #1,1; C$

If str_var is a substring, then the record data is truncated on the
right.  For example, there is no error in the above sequence if line 140
is replaced with:

     140 LINPUT #1,1; C$[1;8]



MPE/iX 5.0 Documentation