Programming instructions
89
Intermec Fingerprint 6.13 – Programmer's Guide
The following instructions are used in connection with output to
random files:
OPEN Creates and/or opens a file for RANDOM
access and optionally specifies the record
length in bytes.
FIELD Creates a random buffer, divides it into
fields and assigns a variable to each field.
LSET/RSET Places data left- or right-justified into the
buffer.
PUT Writes a record from the buffer to the file.
CLOSE Closes an OPENed file.
LOC Returns the number of the last record
written by the use of a PUT statement in
the specified file.
LOF Returns the length in bytes of the speci-
fied file.
To write data to a random file, proceed as follows:
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, e.g.:
10 OPEN "ZFILE" AS #1
Optionally, the length of each record in the file can be specified in
number of bytes (default 128 bytes):
10 OPEN "ZFILE" AS #1 LEN=14
FIELD
Next action to take is to create a buffer by means of a FIELD
statement. The buffer is given a reference number and divided into
a number of fields with individual length in regard of number of
characters. To each field, a string variable is assigned.
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
A1$, A2$ and A3$ respectively.
20 FIELD#1, 4 AS F1$, 4 AS F2$, 6 AS F3$
Graphically illustrated, the record produced in the line above will
look like this:
8. OUTPUT FROM FINGERPRINT, cont'd.
4. Output to Random Files
Continued!