COBOL
I
Commission Calculation Lab
Objectives:
Develop a COBOL program that creates a simple report like this:
WHITE AUTOMOBILE SALES, INC.
COMMISSION REPORT
SALESPERSON SALES COMMISSION
Adkins, Richard $37,453 $$,$$9.99
Allen, Wendy $29,100 $$,$$9.99
Anderson, Brenda $36,102 $$,$$9.99
Babcock, Donald $9,230 $$,$$9.99
and many others
Ziebarth, Kelie $20,340 $$,$$9.99
Summary Report:
Number of employees with up to 10,000 in sales: ZZ9 Number of employees from 10,001 to 20,000 in sales: ZZ9 Number of employees from 20,001 to 30,000 in sales: ZZ9 Number of employees over 30,000 in sales: ZZ9
Total Sales: $$$,$$9.99 Total Commission: $$$,$$9.99
The program will read from the CARSALES.TXT data file.
Commission calculation:
for sales up to 10000, the commision rate is .04 (4%)
for sales between 10001 to 20000, the commission rate is .055 (5.5%)
for sales between 20001 to 30000, the commisison rate is .065 (6.5%)
for sales over 30000, the commission rate is .075 (7.5%)
Sample IF statement:
IF SALES-IN < 10001
MULTIPLY SALES-IN BY .04 GIVING COMMISSION
ADD 1 TO LOW-COMMISSION-CTR
END-IF
IF SALES-IN > 10000 AND < 20001
MULTIPLY SALES-IN BY .055 GIVING COMMISSION
ADD 1 TO SECOND-COMMISSION-CTR
END-IF
Note - the various commission-counters will be defined in Working-Storage section and will need to be initialized to zero:
01 COUNTERS-AND-ACCUMULATORS.
05 LOW-COMMISSION-CTR
PIC 99999 VALUE ZERO.
and so on...
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.
Make an appropriate heading - with your name as part of the title.
Click here to see the full output file.
Objectives:
This will be very similar to previous labs - most notably lab 2.
Internet COBOL students submit your (a) program code (.cbl) and (b) output in one e-mail message
Return to Main COBOL I webpage: