Programming instructions
64
Intermec Fingerprint 6.13 – Programmer's Guide
7. INPUT TO FINGERPRINT, cont'd.
4. Input from a Sequential
File
Continued!
Refer to chapter 7.3 for a summary of instructions used for reading
sequential files.
OPEN
Before any data can be read from a sequential file (or a communi-
cation channel other than the std IN channel), it must be OPENed
for INPUT and assigned a number, which is used when referred to
in other instructions. The number mark (#) is optional. Up to 10 files
and devices can be open at the same time.
Example: The file "ADDRESSES" is opened for input as number 1:
OPEN "ADDRESSES" FOR INPUT AS #1
After a file or device has been OPENed for INPUT, you can use the
following instructions for reading the data stored in it:
INPUT#
Reads a string of data to a variable. Commas can be used to assign
portions of the input to different variables. When reading from a
sequential file, the records can be read one after the other by
repeated INPUT# statements. The records are separated by com-
mas in the string. Once a record has been read, it cannot be read
again until the file has been CLOSEd and then OPENed again.
Example (reads six records in a file and places the data into six
string variables):
10 OPEN "QFILE" FOR OUTPUT AS #1
20 PRINT #1, "Record A","a","b","c"
30 PRINT #1, "Record B",1,2,3
40 PRINT #1, "Record C","x";"y";"z"
50 PRINT #1, "Record D,Record E,Record F"
60 CLOSE #1
70 OPEN "QFILE" FOR INPUT AS #1
80 INPUT #1, A$
90 INPUT #1, B$
100 INPUT #1, C$
110 INPUT #1, D$,E$,F$
120 PRINT A$
130 PRINT B$
140 PRINT C$
150 PRINT D$
160 PRINT E$
170 PRINT F$
180 CLOSE #1
RUN
Yields:
Record A a b c
Record B 1 2 3
Record C xyz
Record D
Record E
Record F