User`s guide

The rest
of
the directory contains one line per program
or
file, each line supplying
three pieces
of
information about its subject.
At the left end
of
each line is the size
of
that line's file in blocks (or sectors)
of
256
characters. Four blocks are equivalent
to
I K (I 024 characters)
of
RAM (read/write)
memory inside the computer.
The
middle
of
each directory line contains the name
of
the file, enclosed in quotation
marks. All characters between the quote marks are part
of
the name, and must be included
when loading
or
opening that
file
.
The
right portion
of
each directory line
is
a three character abbreviation for the file
type
of
that entry. As we will see
in
later chapters, there are many ways to score
information on a diskette, most
of
which are associated with a distinctive file type.
TYPES
OF
FILES AVAILABLE
Currently used file types include:
PRG = Program files
SEQ = Sequential data files
REL
= Relative data files
USR = User (nearly identical to sequential)
DEL = Deleted (you may never see one
of
these.)
(Note: Direct Access files, also called Random files, do not automatically appear
in
the directory. They are discussed in Chapter
7.)
After all the directory entries have listed, the directory finishes with a message
showing how many blocks
of
the diskette are still available for use. This number can vary
from
664 on a new diskette to 0 on one that
is
already completely full.
WATCH
OUT
FOR
SPLAT
FILES!
One indicator you may occasionally notice on a directory line, after you begin saving
programs and files,
is
an asterisk appearing just before the
file
type
of
a
file
that
is
O
blocks long. This indicates the
file
was not properly closed after
it
was created, and that it
should not be relied upon. These
"splat"
files (as they are called
in
England) will
normally need to be erased from the diskette and rewritten. However,
do not use the
Scratch command to get rid
of
them. They can only be safely erased
by
the Validate and
Collect commands.
One
of
these should normally be used whenever a splat
file
is
noticed
on a diskette. (All these commands are described
in
the next chapter.)
There are two exceptions
to
the above warning: one is that Validate and Collect
cannot be used on some diskettes that include direct access (random) files, and the other
is
that
if
the information
in
the splat
file
was crucial and
can't
be replaced, there
is
a way to
rescue whatever part
of
the file was properly written. (This option
is
also described
in
the
next chapter).
20
PRINTING
A
DIRECTORY
To make a permanent copy
of
a directory, perhaps
to
fasten
to
the diskette
's
outer
(paper) envelope, you will need
to
send the directory
to
a printer. such as Commodore
's
MPS
80
l,
1520 and 1526 serial bus models.
To
do this, you may need
to
refer to your
printer manual, but briefly the procedure for listing a directory
to
device 4
is
as follows:
LOAD"$0",8
OPEN
4,4
:CMD 4:LIST
PRINT#4
:CLOSE 4
Also note that all
of
the statements that can
be
combined on one line already have
been. Type them
in
immediate mode
to
avoid disturbing the directory.
All
other options, such as differing device numbers. and selective directories (see
next section) can also be specified as usual
in
the Load command.
WARNING:
Be
sure
to
include the
PRINT#
command after every printer
listing. Otherwise, the printer will remain as an unwanted listener on the serial bus,
and may disrupt other work. Also, do not abbreviate
PRINT#
as?#.
Although
it
will look proper when listed out,
it
will cause a SYNTAX ERROR
in
use. The
proper abbreviation for
PRINT#
is
pR .
READING A
DIRECTORY
AS A
FILE
If you would like to read a directory from within a program, you may do so.
In
Basic
3.5, simply include the
DIRECTORY command
in
your Basic program. In Basic 2,
however, and optionally
in
the others, you will have
to
Open the directory as though
it
we£
a data
file
and read
it
character by character. See the discussion
of
Get#
in
Chapter 5
for
more information.
ANOTHER
WAY
TO
BE
SELECTIVE
Before discussing the pattern-matching options available for use
in
several disk
commands, let's cover one more that
is
only usable
in
a directory. _Several different types
of files can coexist peacefully on the same diskette.
By
altering our directory load
command, we can create a directory from the files
of
a single selected type. Thus, we
might request a list
of
all sequential data files (see Chapter 5), one
of
all the relative data
files
(see Chapter 6),
or
one
of
only program files. To do this, simply add
to
the end
of
your selective directory request the equals sign (
=)
followed by the first letter
of
the
file
type you want
in
your directory. For example, the Basic 2 command:
21