Computers for Smart People by Robert S. Swiatek - HTML preview

PLEASE NOTE: This is an HTML preview only and some elements such as links or page numbers may be incorrect.
Download the book in PDF, ePub, Kindle for a complete version.

4. A report program

 

You can do a great deal with a computer program but in general all programs do the same thing. They read data and produce output, either another file or a listing on paper or on a screen. In the process, sometimes files are updated. The data may be obtained from the system somehow, from screen input or from another file. Despite this simple breakdown, the process could get quite complicated. A program could involve reading a dozen files to get different kinds of data and then produce a few files. A data entry program might involve a screen to allow input, which could be quite complicated. It really depends on the system and what kind of computer you have. Fortunately our system will not be complex and so you may be a little upset to see more complexity when you get to a different system.

Here are a few examples to illustrate this fact. It is discovered that someone messed up the account file for all the begin dates. Instead of 2000 or 2001 for the year, each record has 0000 or 0001 for this value. Someone writes a program to correct this situation. The input to this program is the account file and the result will be either a new one or an updated account file. This all depends on what type of file it is. In either case the two files will be different, with the new one having the correct begin dates. Thus the program will read a file and create an output file. There could be another output file, namely a report to list the records that were changed.

The account file needs to be updated with new accounts from time to time so there is a program to allow input into the file. Once again we have an input file in the data being keyed and probably two output files, the updated account file as well as some kind of report. Even though the report file is not completely necessary, it is probably a very good idea to show the addition of the new accounts.

Our first program will read the account number file and produce a listing of the fields on it. Specifically, we will read a file and produce output in the form of a report, but just one record will be listed. That’s very restrictive, but we’ll get into reading the entire file later.