Information Technology Reference
In-Depth Information
18. Deleting accounts
This next program is a relatively easy one. It's time for the program to delete
records on the account file. We could incorporate this function into the inquiry / update
program but instead we will create a new program. The reason has to do with the fact that
we probably only want certain people to have the ability to delete records. Another
advantage is that the process will be somewhat easier if deletions are separate. Once we
have this program done, we can copy it and modify it and use the result for deleting
records on the zip code file. There is no sense writing a separate program when we have
most of the logic in place.
The program will allow input of an account number and our program will delete
the record, provided the balance is zero. It will then proceed to add the account number to
the next number file. As I mentioned earlier, we may not want to use the account number
over again - at least for a while - so we would just delete the account record. Adding the
deleted record to the other file is just being done for the exercise. A report will be
produced to list all deleted accounts. As before, in case of a serious file access, an error
message will be printed on bottom of the report and listed on the screen.
Our program will be the following:
program-name:
acctdel
define
main-heading
structure
print-month
character
(2)
field
character value
“/”
print-day
character
(2)
field
character
value “/”
print-year
character
(43)
field
character
(73)
value
“Account number deletion report”
field character
(5)
value
“Page”
page-number
integer(
3)
define
sub-heading
structure
field character
(54)
value
“account # last name first name”
field character
(57)
value
“mi street address city state”
field character
(19)
value
“zip balance”
define
print-line
structure
print-account-number
integer(
9)
field character
(4)
value
spaces
print-last-name
character
(22)
print-first-name
character
(19)
print-middle-initial
character
(5)
print-street-address
character
(27)
print-city
character
(19)
print-state
character
(6)
print-zip-code
integer(
5)
field
character
(2) value
spaces