Information Technology Reference
In-Depth Information
9. More Modifications
Let's return to our very first program and consider what happens if we have over a
hundred accounts on the file. If we run the program the report will have heading lines,
followed by detail lines. It will fill up one page and then print the next one without any
header lines. What we want to do is change the program so that there will be a title on
each page, subheadings as before, page numbers and today's date. Note the program name
has been changed. To do this the complete program follows.
program-name : acctlist
define main-heading structure
print-month character (2)
field character value “/”
print-day character (2)
field character value “/”
print-year character (48)
field character (68) value “Account number report”
field character (5) value “Page”
page-number integer( 3)
define sub-heading structure
field character (54) value “account # last name first name mi street ”
field character (68) value “address city state zip balance”
define print-line structure
print-account 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 (29)
print-city character (19)
print-state character (6)
print-zip-code integer( 5)
field character (2) value space
print-balance , mask ($$$$,$$9.99-)
define file acctfile record account-record status acct-status key account-number structure
account-number integer( 9)
last-name character (18)
first-name character (15)
middle-initial character
street-address character (25)
city character (15)
state character (2)
zip-code integer( 5)
balance signed decimal (6.2)
Search WWH ::




Custom Search