CHAPTER
10
PROGRAMMING
IN
ARCHIVE
This
chapter
will
describe
the
development
of
an
actual working example and each new
technique will be described
as
it
IS
needed.
Suppose you are involved
In
running a club or society which charges a subscription
and produces a
newsletter.
You
Will
need
to
send a copy of each issue
to
every pald·up
member.
You
Will
also need
to
send a reminder
to
each member when his or her
subscription falls due.
This example allows you
to
construct a mailing
list
and then print a
set
of address labels
on
request. The address label Includes a reminder when a subscription
is
due.
The
example assumes that
you
send out
six
Issues
of the newsletter per year and that a
person's subscription
falls
due when he or she has received six
issues.
It
could easily
be adapted
to
any situation where
you
regularly send out some form of circular letter
to
a number of people on a mailing list
In
this example
we
shall make
as
much
use
as
possible of the existing facilities and A
MAILING
LIST
introduce some new ones.
If
you
need help with a feature or command you have not
yet
encountered, or one that seems
to
do things
you
don't understand,
you
may now
find
It
quicker
to
look
for
help
in
the reference section or use the help function by pressing
F1.
We
use the insert and alter commands
for
all
additions and changes
to
the
file
records.
We
shall, however need
to
write special routines
to
print out the address labels.
We
shall have
to
cater for the
follOWing
set
of requirements:
Add a new record
to
the
file.
Delete a record.
Modify a record.
Record subscription payments.
Produce the address labels.
Leave
the program.
We
shall
write a procedure
to
handle each of these tasks and link them together
by
another procedure which
will
allow you
to
select any of these options.
In
this application
it
IS
qUite
clear what fields each record must contarn. The name and
address are essential plus one field
to
record the number of issues the person has
received.
We
can create the necessary
file
Immediately,
as
shown below
create
"
ma
i
LII
titleS
fname$
surname$
street$
town$
county$
postcode$
issues
endcreate
We
have used three string fields
for
the person's name;
to
hold the
title
(Dr,
Mr,
Mrs etc),
the
first
name and the surname respectively.
We
could probably have managed
With
Just
a single field.
There are four string fields
for
the address, nominally reserved
for
the street address,
the town, county and postcode.
You
do
not always have
to
use them
in
this
way,
but
can treat them as four general fields
to
hold the address. Four fields should normally
be
qUite
sufficient
There
is
only one numeric field,
to
hold the Information about how many Issues remain
to
be
sent.
Now that
we
have the
file,
we
can use
it
to
test
the various procedures as
we
write them.
It
IS
a good idea
to
test each procedure
as
far
as
possible as
you
go along.
You
can
then spot each mistake as
It
occurs and correct
It
immediately.
If
you
leave
all
the testing
to
the end
It
will be much more complicated
as
several things may be gOing wrong
at
the same
time,
Keep things
as
simple
as
possible while
you
are
stili
testing your
procedures.
Try
to
make sure that each procedure works correctly before
you
move on
to
the next
one.
That way
you
will
find that your
final
program
Will
usually work
as
soon
as
you
have written the last procedure.
12/84
21