COBOL lab #2

 

Objectives:

 Reading Assignment:

 Develop a COBOL program that creates a simple report like this:

                      
             WHITE AUTOMOBILE SALES, INC.
                  COMMISSION REPORT

   SALESPERSON                    SALES     COMMISSION
   Adkins, Richard              $37,453      $1,872.65
   Allen, Wendy                 $29,100      $1,455.00
   Anderson, Brenda             $36,102      $1,805.10
   Babcock, Donald               $9,230        $461.50
   and many others
   Ziebarth, Kelie              $20,340      $1,017.00

The program will read from the CARSALES.TXT data file. It will
calculate the 
commission on the sales at .05 times the sales. Click
here to see the data file.

The data file has the name in columns 1-24 and the sales in columns 25-29 (pic 99999).

In the file section of the data division, you will have:

FD SALES-FILE.
01 SALES-RECORD.
	05 SALESPERSON-NAME 	PIC X(24).
	05 SALES 			PIC 99999.

In working-storage, you will have the following processing variables:


01 FLAGS-AND-ACCUMULATORS.
	05 END-OF-FILE PIC XXX VALUE "NO".
	05 COMMISSION PIC 99999V99.
	05 COMMISSION-RATE PIC V999 VALUE .050.
To get the output to "look nice", you need to numerically
edit it like this:
      05 SALES-OUT            PIC $$$,$$9.
      05 <spaces>
      05 COMMISSION-OUT       PIC $$$,$$9.99.
(The concept of output editing is a bit beyond chapter 2,
but is not very advanced . . . Try it!!!)

Make an appropriate heading - with your name as part of the title.

In the processing, you will have:

MULTIPLY SALES-IN BY COMMISSION-RATE GIVING COMMISSION.

Then several MOVE statements, followed by a WRITE

Click here to see the full output file. 

Objectives:

This will be very similar to labs 0 and 1 - my suggestion is to edit lab 1 and save it as lab 2 (LAB2.CBL).

COBOL students submit your (a) program code and (b)
output in one e-mail 
message to: bruce.white@quinnipiac.edu 

Return to COBOL main page