Information Technology Reference
In-Depth Information
if
process-sw
= 3
screen
(24,1) “next number file is busy - try again later”
else
error
-msg
= “next number file error; program ending - press enter”
go to
end-program
end-if
write-record:
write
acctfile
if
acct-status
= 0
record-counter =
record-counter
+ 1
line-counter
=
line-counter
+ 1
if
line-counter
> 54
perform
print-headings
end-if
print
print-line
screen
(10,36)
last-name
screen
(15,36)
first-name
screen
(20,36)
middle-initial
screen
(5,36)
account-number
else
error
-msg
= “account number file problem; program - press enter”
go to
end-program
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
The program is quite long but only a few lines should be unfamiliar. Note that the
report will only display four fields, so we spaced it out across the page. We spread out the
fields on the screen rather than bunching them all at the top. Whoever is inputting data
will only key in last name, first name and the middle initial. Obviously, we have to check
that they don't key garbage so we use the same procedures for inputting the first two
fields, which has a few checks. For verifying that the middle initial is valid, we use the
line
if
in-middle-initial
=
space
or (>= “A” and <= “Z”) or (>= “a” and <= “z”),
which is a compound logical statement. It just checks to see if what was entered was
either a blank or a letter of the alphabet, upper or lower case. The check