EasyManua.ls Logo

Radio Shack TRS-80 Model 4 - Page 182

Radio Shack TRS-80 Model 4
418 pages
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...
If you want the program to print on your display the information
stored in the updated file, add the following lines:
70
OPEN
"1",1,
"LIST/EMP"
80
IF
EOF(l)
THEN
2000
90
INPUT#
1,
N$
100
PRINT
N$
110
GOTO
80
2000
CLOSE
RUN
Once you have RUN this program, SAVE it.
Example
Direct-Access
Files
SAl.IE
"PAYROLL2"
'saves
the
new
pr09raM
With a direct-access file, you can access data almost anywhere on
disk.
It
is not necessary to read through all the information, as with a
sequential-access file. This is possible because in a direct-access file,
information is stored and accessed
in
distinct units called "records".
Each record is numbered.
Creating and accessing direct-access files requires more program
steps than sequential-access files. However, direct-access files are
more flexible and easier
to
update.
One important note: BASIC allocates space for records in numeric
order. That is, if the first record you write to the file is number 200,
BASIC allocates space for records 0 through 199 before storing
record 200
in
the file.
The maximum number of logical records is 65,535. Each record may
contain between 1 and 256 bytes.
The statements and functions used with direct-access files are:
OPEN
GET
LOC
MKS$
CVS
FIELD
PUT
MKD$
CVD
LSET/RSET
CLOSE
MKI$
CVI
These statements and functions are discussed
in
more detail in
Chapters 6 and
7.
Creating
a Direct-Access
File
1.
To create the file, OPEN it for direct access in
"0"
mode
("R"
may
also be used.
It
stands for "random access", which is simply
another name for direct access).
2-54

Other manuals for Radio Shack TRS-80 Model 4

Related product manuals