COMTRAN Reconstruction

F28-8043 · June 1960

Page 87

PDF page 92 of 124. Download the scanned PDF

The page as scanned

The scan of PDF page 92 of F28-8043
Select the scan to open it at full size.

The text read off it

Appendix 1: Programming Example

[page 87]

Introduction

The Commercial Translator system is so designed that the programmer can analyze a business problem in terms of the problem itself, rather than in terms of the equipment on which it will be processed. He can rely on the processor to convert his source program into a machine program which will take advantage of the operating characteristics of the equipment. Thus, his first approach to a problem will be one in which he determines each of the basic steps needed to solve it, and the sequence in which they must occur.

The basic device for showing the flow of information and the sequence of operations in a simple form is the flow chart. In addition, a process chart will be useful in determining how data should be grouped for input to the system and what data groupings are to be obtained from it. From these two charts the programmer can proceed easily to writing the source program itself.

To illustrate these three phases, the following pages contain a flow chart, a process chart, and a sample program that could theoretically be used for a simplified payroll operation. This program is intended only to illustrate the general method of using the Commercial Translator language and to show how the data to be used in a program might be defined in a typical data description division. It is in no sense an attempt to demonstrate an ideal solution to a payroll problem.

As the process chart shows, there will be two input files—a master file and a detail file. These will be on magnetic tape. The output files, also on tape, will be the following: (1) An updated master file, which will be used as input in the next running of the program. (2) A payroll report file, which will be used to produce a printed report. (3) A check file, which will control the printing and punching of pay checks. (4) An exception, or error, file, which will contain any master or detail record for which no matching detail or master has been found.

Both the master and the detail files consist of individual pay records for each employee, arranged in ascending sequence by employee number. It is assumed that there will be a master record for each detail record with the same employee number, and a detail record for each master record. Any exceptions will be given an error code and moved to the exception file for subsequent correction.

Each master record contains, among other information, hourly pay rate and year-to-date totals for gross pay, retirement premiums, and insurance. Among the items included in each detail record is a statement of the number of hours worked during the current pay period; this, together with the hourly rate in the master record, is used to compute gross pay. The records also contain other data, such as employee name, department, information to be used in performing withholding tax, FICA, bond deduction and other computations, and so on.

Each of these items of data is named and defined in the data description portion of the program, in accordance with the rules given in Chapter 4 of this manual.

The actual procedure statements, which in this case are written before the data description entries, follow the rules given in Chapter 3. The program begins with a renaming of data items, using the CALL command, so that they can be referred to by abbreviated names. It then proceeds to a comparison of the employee numbers used to control the processing, and the reader will see that provisions are made to transfer