146
The
VIC
20
User
Guide
When questions are asked, the program only recognizes meaningful
responses: Y
or
N for
"yes"and
"no,"
or
a number between I and 6 to
select an entry line. A
data
entry subroutine should ignore meaning-
less entries.
For
example, to recognize Y for "yes"
but
any other
character besides N for
"no"
could be disastrous, since accidentally
tapping a key could prematurely take the operator out
of
the current
data
entry. Recognizing N for
"no"
but any other character for "yes"
would cause the operator to reenter
data
unnecessarily into some field
if the wrong key was accidentally pressed.
Here are some data entry precautions that could be added:
Check the
ZIP
code for any nondigit entry. However, postal codes
outside the U.S.A. (Canada, for example) do allow alphanumeric
entries.
Many cautious programmers will ask the question:
ARE
YOU
SURE? when
an
operator responds with
"no"
to the question ANY
CHANGES? This gives the operator who accidentally touched the
wrong key a second chance.
You might
add
a key
that
aborts the current
data
entry and restores
the prior value.
For
example, if the operator presses the wrong
number to select a field
that
must be changed, the example program
forces the operator to reenter the line.
Try modifying the name-and-address entry program to include the
additional safety features described above.
THE
REAL-TIME
CLOCK
Another VIC
20
computer feature
is
the real-time clock. This clock
keeps real time in a 24-hour cycle by hours, minutes, and seconds. The
reserved string variable TIME$,
or
TI$, keeps track
of
the time.
Sefflng
the Clock
To set the clock, use the following format: