The input to the program are two loan master files of identical layout.
The first file (MSTFIL1) contains the summary information by COMPANY and
OBLIGOR number. The second file (MSTFIL2) contains multiple detail records
by COMPANY and OBLIGOR number. The record layout for both files is defined
by the TESTCPY1 copy book. Also note that the first file reflects the summary
of the second file by COMPANY and OBLIGOR.
The data on the first file (MSTFIL1) was recently erroneously updated.
The file key (COMPANY and OBLIGOR) was not affected.
The program must recreate the corrupted file (MSTFIL1) by summarizing
MSTFIL2 by COMPANY and OBLIGOR. Also, management has decided to drop all
records from the first file (MSTFIL1), with the effective date prior to
A report (trial) of the newly created summary file is to be produced
with totals by COMPANY, OBLIGOR and the FINAL totals.
The program must adhere to structured programming techniques and it
must be well documented. The TESTCPY1 copy book is to be used for record
layout of all files. The program will be put into production for resolution
of potential future problems of a similar nature.
The PEngiBAT program on the following page accomplishes the above
task in about 100 statements. It took about two (2) hours to write and
test the program. The generated COBOL program is about 2,600 lines of structured
and well documented code. We estimate that the same task would have taken
40 hours or more if it was written in straight COBOL.
EXPLANATION OF THE BATCH PROGRAM
1 Defines the COBOL program skeleton
2 Defines the two input files, MSTFIL1
3 Defines the output file MSTOUT1
4 Defines working storage fields in native
5 Defines the detailed print line LINE01
6 Defines the main report header
7 Defines the Control Break Line TOTAL1
8 Native COBOL PERFORM statements
9 The EXTRACT macro matches the input files.
MSTFIL1 is sorted before the match. MSTFIL2 is
sorted and summarized before the match.
10 Native COBOL for MSTFIL1 EXIT as defined
11 Native COBOL for inserting the correct
control break description on the TOTAL1 line.
12 The GENERATE macro generates the detail
THE BATCH PROGRAM
See previous page for detailed explanations of the code
(Use numbers on the right side to locate explanation of each
group of code )
NOTE: PEngiBAT generates about 2,600 lines of structured,
clean and consistent COBOL code from the above program, a ratio of 26:1.
Also note that there is no complex logic involved for Matching, Sorting,
Summing and Printing files. PEngiBAT expands all necessary code as needed
for each task.
Back to PEngiBAT