EasyManua.ls Logo

Commodore PET - Program Files; Data Files

Commodore PET
447 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
PROGRAM FILES
A program
is
written
onto the tape
as
an
entire file. Its organization of
records and fields
is
not determined by the programmer.
but
is
done internally
within
the
PET.
The user need
not
worry
about a program file's records and fields.
since they are not important to the programmer.
A program file should have a
unique name
because a name makes
it
much easier to find the program
when
searching the tape. The program file
is
named
with
a SAVE command: in other
words.
the program name becomes the program file name.
Since vou already know how to create a program file. we
will
quickly review
the procedure
(see
Chapter
3).
There are three steps in
writing
a program file:
1.
Code the program and type
it
into memory.
2.
SAVE the program on tape.
3.
VERIFY
the SAVEd program.
The first step
is
to code and th
en
enter the program into the PETs memory.
The second step uses the SAVE command:
SAVE"filename".device.s
where:
filename
device
s
is
the program name enclosed in quotes.
(optional)
is
a predefined number (1-255).
(optional)
is
a secondary address code (0-5).
See
Table 4-2.
The third step
VERIFIES
the program
just
SAVEd on tape by comparing
it
to
memory to make sure everything
is
written
correctly. Rewind the tape and type:
VERIFY"filename"
where:
filename
DATA
FILES
is
the program filename
just
SAVEd.
The other type of files are data files. The data file,
as
its name implies.
C9n-
tains data to be read from a program file. Unlike a program file. the program-
mer may define the organization of a data file into records
and
fields. The pro-
grammer may establish the number of fields in each record. and the number of
records
in
each file. He/she may also set maximum lengths or allow records and
fields to
be
variable in length. The program file may
be
programmed to read or
write
any type of data to or from the data tape.
whether
numeric. alphabetic. con-
stant. or string.
The emphasis of this section
is
on
data files - how to create and
manipulate them
with
program files. Therefore, throughout the remainder of
this chapter the term
"file"
refers to "data
file,"
unless "program
file"
is
clearly stated. Further. the discussion of data files concentrates
on
files stored on
cassette tape.
239

Table of Contents

Related product manuals