Intermec PC43d Fingerprint Developer's Guide (PC23d, PC43d/t, PM23c, PM43, PM4 - Page 57
Input From Sequential Files, Reading Data to a Variable With INPUT#
View all Intermec PC43d manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 57 highlights
Chapter 4 - Managing Input and Output Input From Sequential Files To read from a sequential file (or a communication channel other than the std IN channel), the file 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. In this 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, use these Fingerprint commands to read the data stored in the file or device: • INPUT# • INPUT$ • LINE INPUT# • CLOSE Reading Data to a Variable With INPUT# 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 commas in the string. Once a record has been read, it cannot be read again until the file has been closed and then opened again. This example reads six records in a file and places the data in six 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 The printer returns: Record A a b c Record B 1 2 3 Record C xyz Record D Record E Record F Fingerprint Developer's Guide 45