112 NA$ = LEFT$(DA$,27)
114 SA$
= MID$(DA$,28,27)
116 CS$
= MID$(DA$,55,23)
118 ZP$
= RIGHT$(DA$,IO)
120 PRINTNA$:PRINTSA$
130 PRINTCS$:PRTNTZP$
140 CLOSE3:CLOSEI5:END
1000INPUT#15,EN,EM$,ET,ES
1002 IF
EN<20
THEN RETURN
1002 PRINT "ERROR: "EM$:CLOSE3:CLOSE l5:END
READY.
THE
VALUE
OF INDEX FILES (ADVANCED USERS)
In
the last two chapters you have learned how
to
use sequential and relative files
separately. But they are often used together, with the sequential
file
used
to
keep brief
records
of
which name
in
the relative
file
is
stored
in
each record number. That way the
contents
of
the sequential
file
can be read into a string array and sorted alphabetically.
After sorting, a technique known
as
a binary search can be used to quickly
find
an
entered
name in the array, and read
in
or write the associated record
in
the relative file. Advanced
programs can maintain two or more such index files, sorted
in
differing ways simulta-
neously.
66