INPUT
|
Syntax: |
INPUT <File Number>,<Variable> ON
ERROR … END
|
||||
|
|
|
||||
|
Meaning: |
Reads a value from a sequential file and
assigns it to the variable <Variable>. The respective file must have
been opened with OPEN INPUT. In the case of an
error the block ON ERROR ... END is executed. Note: Before every INPUT instruction the file end must be tested with IF EOF(...) or WHILE NOT EOF (...). The end of the value to be read is defined in
the following ways: 1.
file end 2. The first read character is a quotation
mark ", the value then ends with the second quotation mark or the end of
the line. The quotation marks do not belong to the read value, but function
as separators. 3. The 1st read character in the input field is
not a quotation mark, the value then ends with the next comma or the end of
the line. The comma does not belong to the read value but functions as
separator. Leading blanks are not read with numeric
variables, independent of whether the value is written in quotation marks or
not. Note: If data are written with an OUTPUT
instruction and later are to be read again with INPUT, the separators must be
returned as well if several variables are returned in an OUTPUT instruction (read
OUTPUT). |
||||
|
Parameter: |
|
||||
|
Sample: |
OPEN OUTPUT,1,"XYZ"
ON ERROR ... Error ... END /* Output: -123.4 , 8 ,Test K = -1.234 ON
ERROR ... Error ... END /* Output: "1",20,"Test" K = 1 ON
ERROR ... Error ... END CLOSE 1 ON ERROR
... Error ... END ... OPEN INPUT,2,"XYZ" ON ERROR ... Fehler ... END WHILE NOT EOF(2)
DO INPUT
2,K ON ERROR
... Error ... END INPUT
2,L ON ERROR
... Error ... END INPUT
2,H$ ON ERROR ... Error ... END ... ENDDO |
||||
|
See also: |
|