EasyManua.ls Logo

Tandy TRS-80 - Chapter 61 Changing

Tandy TRS-80
104 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...
CHANGING IT ALL AOUND
BO OPEN
"0".
»lf "MEMBERS/DAT"
90 GOSUB 430
100 IF N*="" THEM CL0SE«1:END
110 WRITE *1 i N$t
A*.
P*
120 GOTO 90
430 CLS: PRINT "PRESS <ENTER> WHEN
FINISHED" :PRINT
440
INPUT
"NAME
OF MEMBER: "iN$
450 IF N$
=
""
THEN 480
4G0 INPUT "ADDRESS
:
" ? A*
470 INPUT "PHONE NUMBER
:"!
P$
480 RETURN
Now finish it by solving
this
Programming Exer-
cise. It'll be difficult, but
we
think
you can do it.
Remember, no one's watching. If
you get bogged
down, refer to the answer in Appendix A for
help.
PROGRAMMING
EXERCISE
#6.3
Write a program in which
you can:
1. See the names,
addresses,
and
phone
numbers
ofyour club's
members.
2. Change the
addresses
ofsome of
the members.
3. Add
new
members.
4. Delete
some
of the members.
All of this works
quite
well
on
a small scale, but
how would it work in
a
large
file?
What
if you had
500 members in
your "MEMBERS/DAT"
file and
you wanted
to change
only
the address of the
453rd member?
The
process
would still be the same.
You would
have
to input each of the 500
members from
one
file and
then
output them all to another file. All
of
this
just to
change
one record. There must
be
an
easier
way!
The
easier way is
called the direct access
method
of programming.
It makes your files
easier and
faster to
update,
but
in
many cases it will make
them take up
more
space in your disk. The choice
is yours. We'll talk
about
direct
access in the next
chapter.
Note: We've
demonstrated short example
programs.
There are many ways
you could improve them. See
the "Sample Programs" in
Appendix
C
for
ideas.
CHAPTER CHECKPOINT
Why
can 't you input and
output data
to
the
same
buffer at the same time?
Can
you input data from a file OPENed for
"O"—output?
31

Related product manuals