Intermec PC43d Fingerprint Developer's Guide (PC23d, PC43d/t, PM23c, PM43, PM4 - Page 60

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

Page 60 highlights

Chapter 4 - Managing Input and Output 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 43, 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 42. 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. Now you can use the variables assigned to the fields using the FIELD statement to handle the data. Numeric expressions converted to string format before being put into the record can now be converted back to numeric format using VAL functions. In this example, the following code displays the data on the host screen: 40 PRINT F1$,F2$,F3$ 48 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

Chapter 4 — Managing Input and Output
48
Fingerprint Developer’s Guide
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 43
, 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 42
.
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.
Now you can use the variables assigned to the fields using the FIELD statement to
handle the data. Numeric expressions converted to string format before being put
into the record can now be converted back to numeric format using VAL functions.
In this example, the following code displays the data on the host screen:
40
PRINT F1$,F2$,F3$
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