Information Technology Reference
In-Depth Information
get-city-state: city = spaces
state = spaces
zip = zip-code
read zipfile
if zip-status = 5
screen (24,20) “zip code “ zip “ is not on the file.”
else
if zip-status > 0
error-msg = “zip file problem; program ending - press enter”
go to end-program
end-if
end-if
print-headings: page-counter = page-counter + 1
page-number = page-counter
line-counter = 5
print page main-heading
print skip (2) sub-heading
print skip
end-program: print-count = record-counter
print skip (2) total-line
print skip error-msg
screen (24,20) error-msg input
end
You may be asking why the program is so long if this is a simple process. If we
had displayed data on the screen, it would have been even longer. The task is not
complicated, but achieving it involves a great deal of logic. We're producing a report of
what's happening on paper and access to the files is rather complex. A successful delete
means we read the account file, read the zip code file for the city and state, deleted a
record from it as long as the balance is 0 and added a record to the next number file. This
could be simplified somewhat if we changed the report and only printed the account
number, last name and first name, as well as not update the next number file. We chose to
print out all the information on the file to help the users.
Note that for the most part, we used lines of code from other programs, such as
the update program and the report program. Again, why repeat what has already been
done. The main logic is to get an account number to delete and read the account file to
make sure that it's there, but also that the balance on the record is zero. It's probably not a
good idea to close an open account, so that's why we need this further restriction. If the
record can be deleted, we delete it and add an appropriate record to the next number file,
with an indicator of d . We also print the record that has been deleted on a report with all
the fields on the record. Since the account file has only the zip code and not city and state,
we have to get those two fields from the zip code file. This results in the structure of the
file appearing to be different from before, but it's still the same file.
Search WWH ::




Custom Search