Intermec PD42 Fingerprint Developer's Guide (old) - Page 66

Input From a Random File, Creating a Buffer With FIELD, Copying a Specific Field With GET

Page 66 highlights

Chapter 4 - Managing Input and Output The example illustrates how the length of the file "PRICELIST" is returned: 10 OPEN "PRICELIST" AS #5 20 PRINT LOF(5 Input From a Random File To read the data stored in a random file, you must OPEN it. This section uses the random file created in "Generating Random Numbers" on page 45, which can be illustrated as follows: Record: 1 2 3 Field: 1 2 3 123 1 23 Byte: 1 2 3 4 1 2 3 4 1 2 3 4 5 6 1 2 3 4 1 2 3 4 1 2 3 4 5 6 1 2 3 4 1 2 3 4 1 2 3 4 5 6 10 OPEN "ZFILE" AS #1 LEN=14 LEN=14 refers to the length of each record, which is 14 bytes (4 + 4 + 6). Do not confuse the LEN parameter in the OPEN statement with the LEN function. For more information, see "Converting Input Data" on page 44. The following Fingerprint commands are used in connection with input from random files: • FIELD • GET • CLOSE • LOC • LOF Creating a Buffer With FIELD A FIELD statement is used to create a single-record buffer for a random file, and divides the buffer into fields. Each field can be assigned a string variable. Using the random file example, the following code chooses Field #1, and assigns the first 4 bytes to the string variable F1$, the second 4 bytes to F2$, and the remaining 6 bytes to F3$: 20 FIELD#1, 4 AS F1$, 4 AS F2$, 6 AS F3$ Copying a Specific Field With GET A GET statement copies the desired record from the file. You can select any record (as opposed to sequential files, where records are read one after the other). For this example, we will copy the first record: 30 GET #1,1 You can copy data from other records in the same file by issuing additional GET statements. 50 Intermec Fingerprint Developer's Guide

  • 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
50
Intermec Fingerprint Developer’s Guide
The example illustrates how the length of the file “PRICELIST” is returned:
10
OPEN “PRICELIST” AS #5
20
PRINT LOF(5)
.....
.....
Input From a Random File
To read the data stored in a random file, you must OPEN it.
This section uses the random file created in
“Generating Random Numbers” on
page 45
, which can be illustrated as follows:
10
OPEN “ZFILE” AS #1 LEN=14
LEN=14 refers to the length of each record, which is 14 bytes (4 + 4 + 6). Do not
confuse the LEN parameter in the OPEN statement with the LEN function. For
more information, see
“Converting Input Data” on page 44.
The following Fingerprint commands are used in connection with input from
random files:
FIELD
GET
CLOSE
LOC
LOF
Creating a Buffer With FIELD
A FIELD statement is used to create a single-record buffer for a random file, and
divides the buffer into fields. Each field can be assigned a string variable.
Using the random file example, the following code chooses Field #1, and assigns the
first 4 bytes to the string variable F1$, the second 4 bytes to F2$, and the remaining
6 bytes to F3$:
20
FIELD#1, 4 AS F1$, 4 AS F2$, 6 AS F3$
Copying a Specific Field With GET
A GET statement copies the desired record from the file. You can select any record
(as opposed to sequential files, where records are read one after the other). For this
example, we will copy the first record:
30
GET #1,1
You can copy data from other records in the same file by issuing additional GET
statements.
1
2
3
1
2
3
Field:
Record:
Byte:
1
2
3
1
2
3
1
2
3
4
5
6
1
2
3
4
1
2
3
4
1
2
3
4
5
6
1
2
3
4
1
2
3
4
1
2
3
4
5
6
1
2
3
4
1
2
3
4