Login Products Contact Register Home


PEngiBATTM Program Example

Input Files

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.

Problem Definition

The data on the first file (MSTFIL1) was recently erroneously updated. The file key (COMPANY and OBLIGOR) was not affected.

Program Objective

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 1992.

A report (trial) of the newly created summary file is to be produced with totals by COMPANY, OBLIGOR and the FINAL totals.

Programming Standards

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 Results

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 and MSTFIL2

          3 Defines the output file MSTOUT1

          4 Defines working storage fields in native COBOL

          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 in (9)

          11 Native COBOL for inserting the correct control break description on the TOTAL1 line.

          12 The GENERATE macro generates the detail report


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


Copyright © Foundation Software, Inc., 2001. All rights reserved. Legal.