Examining
a
Fie
giving a
list
of fields
aher
the order command. For each of the
keys
you must specify
whether the sort
is
to
be
In
ascending or descending
order.
The following command,
for example,
will
sort the
file
into descending order
by
population and ascending order
by capital.
order
pop;d,capitaL;a
Note that a semicolon separates each field name from the
'\oj"
or
'ij"
that specifies
ascending or descending
order,
but that each pall (field name and letter)
IS
separated
trom the next by a comma.
When more than one field
is
specified for sorting purposes the records are initially sorted
according
to
the contents of the first field
In
the
list.
If
two or more records have the
same contents
for
this field, they are ordered according
to
the next field
In
the
list.
If
records exist which are equal
in
respect of the contents
of
both of these two fields, they
are ordered according
to
the contents at the third field, and
so
on.
LOCATE
When a
file
has been sorted, you can use the locate command
to
make any particular
record the current record
In
the
file.
Its
action
IS
to
find the first record whose first sort
field
is
greater than or equal
to
the given expression.
This
record becomes the current
record
In
the
file.
For example,
if
the
'gaze1"
file
has been sorted
as
described
In
the
last
example, the
command:
Locate
"100"
locates the first country
in
the sorted
file
which has a population of 100 million.
If
there
is
no such country Archive
will
locate the first country with a population less than 100
million (remember that the
file
was sorted
In
descending order).
Locate
is
followed by an expression which may be either text or numeric, but must be
of the same type
as
the field used
to
sort the
file.
(See
the Reference chapter)
You
can locate a record
With
respect
to
the contents of more than one sort field by using
locate with multiple expressions, separated by commas. For example,
Let a="100"
Let
b$="O"
Locate
a,
b$
will find the first country with a population of 100 million or
less,
and
with
a capital whose
name either starts with "0" or
is
aher "0"
in
the alphabet.
In
this example Archive
Will
locate Bangladesh, which has a population
of
76.1
million and whose capital
is
Dacca.
The only restriction
on
the number of expressions that
you
can use
With
locate
is
the r
number of fields used
to
sort the
file.
..
You
cannot use continue aher locate. Repeating a locate with the same condition will
always locate the same record.
Locale
is
the
fastest
way
of locating a record
in
a large, sorted,
file.
Because of the
uncertainty
in
the record that
is
located,
you
may have
to
make a further check on the
record
to
make sure
it
is
what
you
want.
CLOSING
A
FILE
When
you
have finished looking at a
file
you
must
tell
Archive.
You
can
do
this by typing
cLose
ThiS
will only act on files and
will
leave any program or screen layout intact.
You
can
close
all
your
files
and clear out your data and display area by typing
new
This will clear Archive
to
its
initial
state
after loading.
This only acts on the data
files,
leaVing any program, or screen
layout,
Intact.
Alternatively,
if
you have finished using Archive,
you
can go back
to
SuperBASIC by
using quit. This command closes
all
open
files
automatically before leaving Archive.
Remember that
you
should never remove a cartridge from a Microdrive while
it
contains
open files.
8 12/84