CCP COBOL assignment #2


The second COBOL program assignment involves creating a COBOL program to produce a report containing header lines, edited output, and a total line.

The data for this program is in CSCSMS.CSC.ELECBIL2.

PURPOSE -- to gain experience

1)      writing COBOL programs
2)      writing report heading lines
3)       preparing edited output (for reports)
4)      debugging sample COBOL programs.

Due Date -- to receive full credit for this assignment, the program must be available to the instructor prior to the start of the 4th class session.


All customers have an electric meter and are charged so much per kilowatt of use (some more than others).  The company needs a report listing all the customers, their kilowatt usage, and the monthly electric charge (each customer record is a monthly customer record).  The company also wants certain monthly totals-number of customers, total kilowatts used, and total amount charged.


Input record specifications:  (CSCSMS.CSC.ELECBIL2) - 64 byte records

FIELD                      COLUMNS
Name                         1-20
Address                     21-40
Previous kilowatt usage     41-45
Current kilowatt usage      51-55
Charge per kilowatt         63-64 (assumed  decimal)

Output record (report line) specifications
Each output record should have the following format:

FIELD                      COLUMNS
Name                         6 -  25
Address                     41 -  60
Previous Kilo usage         71 -  75 (0 suppressed)
Current kilo usage          81 -  85 (0 suppressed)
Charge/kilowatt             91 -  94 (0 suppressed)
Total kilowatts used       101 - 106 (0 suppress)
Invoice amount             111 - 118 (edited)
Usage message              120 - 130

The following processing must occur:

Invoice amount = (current kilo usage-previous kilo usage) * charge/kilo
Usage message =
 HIGH (if usage over $200),
 MEDIUM (if usage between $100-$200 inclusive),
 LOW (if usage is less than $100).

Watch for meter rollover!

A correctly designed and coded program should yield the following output (for each of valid sales record):

Example of input:

STEVE SAMUELS 1415 PERSHING  09000 11000 08
JOEL BERNSTEIN 609 LIBERTY   99400 00200 07

Example of output:

                                      READ   READ  KILO    USED  AMOUNT
STEVE SAMUELS      1415 PERSHING       9000 11000  .08     2000  $160.00   MEDIUM
JOEL BERNSTEIN     609 LIBERTY        99400   200  .07      800   $56.00   LOW