Objective
This report calculates employee bonuses based upon individual salary and longevity.
The repetitive computation based on longevity is executed by using PERFORM/RETURN statements.
Parameters
017 IF SALARY GT 15000 100 017 COMPUTE SALARY X 0.02 BONUS 017 PERFORM 500
100 directs processing to sequence line 100 when SALARY is greater than $15,000.
PERFORM 500 directs processing to sequence line 500 to calculate the longevity factor.
017 IF BONUS LT 500 010 017 MOVE 500 TO BONUS 017010 TAKE
010 directs processing to sequence line 010 if the calculated bonus is less than $500.
TAKE causes the type 5 line to be extracted.
017100 IF SALARY GT 25000 200 017 COMPUTE SALARY X 0.03 BONUS 017 PERFORM 500
200 directs processing to sequence line 200 when SALARY is greater than $25,000.
PERFORM 500 directs processing to sequence line 500 to calculate the longevity factor.
017 IF BONUS LT 1200 110 017 MOVE 1200 TO BONUS 017110 TAKE
110 directs processing to sequence line 110 if the calculated bonus is less than $1200.
TAKE causes the type 5 line to be extracted.
PERFORM 500 directs processing to sequence line 500 to calculate the longevity factor.
017500 IF START-YEAR LT 81 510 017 BONUS + 100 BONUS 017 RETURN 017510 BONUS + 300 BONUS 017520 RETURN
500 tests START-YEAR. Employees who started before 1981 receive an additional $300 bonus. Those starting after 1981 receive an additional $100 bonus.
017520 RETURN directs processing back to the statement following the last PERFORM statement executed.
Complete Code
col. 2 ▼ IN 200 F 400 PS(TAPE) REC EMPLOYEE 5 25 REC LAST-NAME 15 15 REC START-YEAR 97 2 2 REC SALARY 160 5 3 DP=2 01SORT LAST-NAME 013 EMPLOYEE BONUS REPORT 010 BONUS DP=2 0151*010 EMPLOYEE SZ=20 HH 'EMPLOYEE' 'NAME' 0151*020 SALARY SZ=10 F$ HH ' SALARY' 0151*030 BONUS SZ=7 F$ HH ' BONUS' 017 IF SALARY GT 15000 100 017 COMPUTE SALARY X 0.02 BONUS 017 PERFORM 500 017 IF BONUS LT 500 010 017 MOVE 500 TO BONUS 017010 TAKE 017100 IF SALARY GT 25000 200 017 COMPUTE SALARY X 0.03 BONUS 017 PERFORM 500 017 IF BONUS LT 1200 110 017 MOVE 1200 TO BONUS 017110 TAKE 017200 COMPUTE SALARY X 0.04 BONUS 017 PERFORM 500 017 IF BONUS LT 1800 210 017 MOVE 1800 TO BONUS 017210 TAKE 017500 IF START-YEAR LT 81 510 017 BONUS + 100 BONUS 017 RETURN 017510 BONUS + 300 BONUS 017520 RETURN
Result
REPORT NO. 01 EMPLOYEE BONUS REPORT mm/dd/yy PAGE 1 EMPLOYEE NAME SALARY BONUS ROY ANDALE $33,500.00 $1,640.00 MICHAEL ANGELO $18,000.00 $840.00 HARRY ARM $46,000.00 $1,800.00 MONTE BANK $80,000.00 $1,800.00 JUNE BLOOMER $15,000.00 $500.00 CHARLES BOWER $38,500.00 $1,800.00 C. BREEZE $38,000.00 $1,800.00 RALPH TYRO $20,000.00 $900.00 RICHARD WAGNER $47,000.00 $1,800.00 ROGER WILCO $80,000.00 $1,800.00 ROBBY WILDER $90,000.00 $1,800.00 BETSY ZEDI $37,000.00 $1,780.00 $2,522,500.00 $81,950.00
|
Copyright © 2014 CA.
All rights reserved.
|
|