Information Technology Reference
In-Depth Information
screen (24,20) “invalid characters in the last name - try again”
and the operator has to try again to input a correct name. Note that our code will not
restrict the person from entering ten periods for the name, which is not correct but will
pass the test. The paragraph
input-first-name
is very similar to that of the last name. Had we allowed changes to the street address,
using
name-string
we'd have fallen short in out checking process because we need a few more characters
such as numbers. These are needed for making up a valid street address, and there may be
a few more acceptable characters that we have to add. Using
name-string
as is will result in 123 Main St. being rejected.
The
write
statement should always work but we put in the check just in case the value of
acct-status
returned is not 0. The reason why we don't anticipate a status other than 0 is because the
account number that we are about to write is what we read earlier. However, there could
be other problems with the account file. Let us suppose the data base analyst accidentally
deletes the file while we're in the middle of changing the record. At that point the write of
the new record would fail. We would take care of that very situation by the error message
along with the ending of the program since we cannot proceed further. We trust the file
won't get deleted by mistake, but accidents do happen. Don't forget, we are dealing with
human intervention.
Getting back briefly to entering the names and balance, note that the person at the
keyboard might get stuck entering any of the three fields. To solve the problem, he could
enter
John
for the first name,
Smith
for the last name and
0
for the balance. These would probably be incorrect but at least the person would not be
hung up. We don't want the operator being stuck in a loop and never escaping. A better
idea would be for the user to note the original three values and key them when stuck.
Rewriting the record with the old values won't cause any change - only updating the
counter for records updated.
We next look at the paragraph
update-check ,
which we will arrive at when the operator keys in 0 for field-no. This means either the
screen displayed the data for a specific account and the user decided she wanted to input
another account number without any changes to this one or she made at least one
modification and now is finished. In the latter case we have to update the account record.
Search WWH ::




Custom Search