Intermec PB32 Fingerprint Developer's Guide (old) - Page 78

Output to Random Files, Opening a File for Random Input or Output With OPEN

Page 78 highlights

Chapter 4 - Managing Input and Output Output to Random Files These Fingerprint commands are used in connection with output to random files: • OPEN • FIELD • LSET/RSET • PUT • CLOSE • LOC • LOF Opening a File for Random Input or Output With OPEN Start by OPENing a file for random input/output. Since random access is selected by default, the mode of access can be omitted from the statement, as in this example: 10 OPEN "ZFILE" AS #1 Optionally, the length of each record in the file can be specified in number of bytes (default is 128 bytes): 10 OPEN "ZFILE" AS #1 LEN=14 Creating a Buffer With FIELD Next, create a buffer using a FIELD statement. The buffer is given a reference number and divided into a number of fields, each with a specified number of characters. A string variable is assigned to each field. The buffer specifies the format of each record in the file. The sum of the length of the different fields in a record must not exceed the record length specified in the OPEN statement. In the example below, 4 bytes are allocated to field 1, 4 bytes to field 2 and 6 bytes to field 3. The fields are assigned to the string variables F1$, F2$, and F3$ respectively. 20 FIELD#1, 4 AS F1$, 4 AS F2$, 6 AS F3$ The record produced looks like this: Record: 1 Field: 1 2 3 Byte: 1 2 3 4 1 2 3 4 1 2 3 4 5 6 The file can consist of many records, all with the same format. To produce files with different record lengths, the file must be OPENed more than once and with different reference numbers. Now it is time to write some data to the file. Usually the data comes from the host or from the printer keyboard. In this example, we will type the data directly on the host and assign the data to string variables: 62 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
62
Intermec Fingerprint Developer’s Guide
Output to Random Files
These Fingerprint commands are used in connection with output to random files:
OPEN
FIELD
LSET/RSET
PUT
CLOSE
LOC
LOF
Opening a File for Random Input or Output With OPEN
Start by OPENing a file for random input/output. Since random access is selected
by default, the mode of access can be omitted from the statement, as in this example:
10
OPEN “ZFILE” AS #1
Optionally, the length of each record in the file can be specified in number of bytes
(default is 128 bytes):
10
OPEN “ZFILE” AS #1 LEN=14
Creating a Buffer With FIELD
Next, create a buffer using a FIELD statement. The buffer is given a reference
number and divided into a number of fields, each with a specified number of
characters. A string variable is assigned to each field.
The buffer specifies the format of each record in the file. The sum of the length of
the different fields in a record must not exceed the record length specified in the
OPEN statement.
In the example below, 4 bytes are allocated to field 1, 4 bytes to field 2 and 6 bytes to
field 3. The fields are assigned to the string variables F1$, F2$, and F3$ respectively.
20
FIELD#1, 4 AS F1$, 4 AS F2$, 6 AS F3$
The record produced looks like this:
The file can consist of many records, all with the same format. To produce files with
different record lengths, the file must be OPENed more than once and with
different reference numbers.
Now it is time to write some data to the file. Usually the data comes from the host or
from the printer keyboard. In this example, we will type the data directly on the host
and assign the data to string variables:
1
1
2
3
Field:
Record:
Byte:
1
2
3
4
5
6
1
2
3
4
1
2
3
4