Intermec PB31 Fingerprint Developer's Guide (old) - Page 63

Input From Sequential Files, Reading Data to a Variable With INPUT#

Page 63 highlights

Chapter 4 - Managing Input and Output The standard IN channel is used for sending instructions and data from the host to the printer to perform a variety of tasks, such as controlling the printer in Immediate Mode, creating programs in Programming Mode, downloading program files, or transmitting input data. The following Fingerprint commands receive data only on the standard IN channel: • INKEY$ • INPUT • LINE INPUT 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$ Intermec Fingerprint Developer's Guide 47

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187

Chapter 4 — Managing Input and Output
Intermec Fingerprint Developer’s Guide
47
The standard IN channel is used for sending instructions and data from the host to
the printer to perform a variety of tasks, such as controlling the printer in
Immediate Mode, creating programs in Programming Mode, downloading program
files, or transmitting input data.
The following Fingerprint commands receive data only on the standard IN channel:
INKEY$
INPUT
LINE INPUT
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$