The person who has the highest salary in the organization is located. A single loop is performed, during that the salaries are examined and the highest salary determined. The loop is implemented using statement DO GOTO. Local variable I is the number of salaries to be examined. Local variable J is a counter that was previously set to zero.
Figure 206 DO GOTO Statement – Example 2
LIBRARY : CTB.PROD.RULES RULE : MAXSAL
COMMAND ===> SCROLL===> CRSR
+-----------------------------------------------------------------------------+
===========================================================================
EXECUTE CHECK UPON C
ON DATA
ALWAYS
DO SET = MAX_SALARY=0 C
DO SET = MAX_COUNTER=0 C
DO
LABEL: LOOP
IF SALARY%%J > MAX_SALARY C
DO SET = MAX_SALARY=SALARY%%J C
DO SET = MAX_COUNTER=J C
DO
IF J<I C
DO SET = J=J+1 C
DO GOTO LABEL LOOP
DO
ALWAYS
DO PRINT = THE MAXIMUM SALARY IS %%MAX_SALARY F C
DO PRINT = IT IS EARNED BY %%PERSON%%MAX_COUNTER F C
DO
PLEASE FILL IN RULE DEFINITION. 11.27.52
Parent Topic |