Lab 6

Goals

Use edited output for all information

Part A – Double Control Break Algorithm Using Tables

Write a COBOL program named lab6a.cob to accomplish the following.

The only difference is that the input file is not sorted. You will use a 2–dimensional table to accumulate the totals for each hospital (think of a 2–d table as a spreadsheet. It has columns and rows. Each cell will be a bucket where you dump in the data).

(Unrealistic) Assumptions:

PROBLEM

Many hospitals are a part of the United Healthcare of Ohio (UHOH) Insurance system. Each hospital accepting UHOH Insurance has a unique numeric identification number. UHOH Insurance would like a report to determine the total and average amount of unpaid bills still owed for each hospital as well as the grand total and average amount of unpaid bills for all of the unpaid bills in the UHOH Insurance system.

INPUT

The input file ~sgomori/students/cis314/lab6ain.dat has been created for you and has the following specifications for each billing recipient. You do not know how many records are in the input file or how many records each hospital has. You may not assume that the file is sorted. You may assume that this file has no invalid data.

Copy the input file to your local directory and have your program read it from there.

OUTPUT

The report file will be named lab6aout.dat. The output should look basically like the following:

Each Page Header should look something like this:

 
Date: MM/DD/YYYY                            NAME OF INSURANCE SYSTEM                          Page 999
Time: HH:MM:SS

At the start of each set of hospital data you are to print the hospital name and number, as is shown below. Do not print headings for hospitals that have no data.

HOSPITAL NAME:   name of hospital
HOSPITAL NUMBER: unique hospital id number
 
For each hospital you will then print the total amount owed for each patient, as follows. Do not print a line for any patient that has no data.
 
PATIENT:  patient number - patient name        TOTAL AMOUNT:  $999,999.99

Once the data for each hospital has printed, output the average and total bill amounts owed for that hospital (using proper edited output):

The average bill amount owed is:   $9,999,999.99
The total bill amount owed is:   $999,999,999.99

Once the end of the input file is detected, output (using proper edited output):

The average bill amounted owed for UHOH Insurance is:     $9,999,999.99
The total bill amount owed for UHOH Insurance is:     $9,999,999,999.99

Submitting Lab 6

The files to submit are:

Deleting Unnecessary Files

Use the clean utility described in Lab 2.