Information Technology Reference
In-Depth Information
24. A program in action
We spent a great deal of time on concepts of programming. Before continuing,
let's present an easier way to sort a file than by the bubble sort of the last chapter. In this
case, we want to sort the account number file in ascending order by zip code, then by last
name, first name and middle initial, producing a report with all those fields and the
account number.
program-name : sortedlist
define main-heading structure
print-month character (2)
field character value “/”
print-day character (2)
field character value “/”
print-year character (42)
field character (74) value “Sorted account number file report”
field character (5) value “Page”
page-number integer( 3)
define sub-heading structure
field character (13) value spaces
field character (19) value “zip code”
field character (32) value “last name”
field character (29) value “first name”
field character (15) value “initial”
field character (22) value “account number”
define print-line structure
field character (13) value spaces
print-zip-code integer( 5)
field character (14) value spaces
print-last-name character (18)
field character (14) value spaces
print-first-name character (15)
field character (14) value spaces
print-middle-initial character
field character (14) value spaces
print-account-number integer( 9)
define file acctfile record account-record status acct-status structure
field character (100)
define file sortfile record sorted-record status sort-status key account-number structure
account-number integer( 9)
last-name character (18)
first-name character (15)
middle-initial character
field character (42)
Search WWH ::




Custom Search