Information Technology Reference
In-Depth Information
15. Adding records and calling a program
Now it's time to discuss that program which I asked you to write a few pages ago.
It will illustrate adding records to the account number file as well as calling a program to
obtain a new account number. The calling program will have the operator enter last name,
first name and middle initial. Once all three are entered and valid, an account number will
be generated by the system, through the called program,
nextnumb ,
which passes back the new account number to the calling program. The called program
will read a new file called the next number file, which is defined with the key of account
number and set up by the data base analyst. It consists of an indicator, which will be a
blank or d , and the next available account number. Besides the next account number,
there will also be records with account numbers that are available due to the deletion of
records from the account number file.
Before any records exist on the account file, the next number file will have one
record and the key or next available account number will be 10. If there are yet to be
deletions to the account number file and the file has twenty records, the next number file
will have one record with the key of 30, with the indicator equal to a space. At this point
if someone deleted the record with account number equal to 15, the next number file
would have two records, looking like this:
Key
indicator
000000015
d
000000030
The called program giving us the next account number will be included in the next
chapter. The procedure to add an account will be accomplished when the three data fields
are correctly entered. To exit this program, the user should enter xx for the last name. The
lines of the calling program follow.
program-name: acctcall
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 “New account number addition 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 ”
define print-line structure
Search WWH ::




Custom Search