User guide

Example ENFORM Programs
058058 Tandem Computers Incorporated D–15
The following program creates a user-aggregate called total-new . Used with the
argument “salary OVER job”, total-new adds a 10 percent increase to each original
salary over 30000 and a 7 percent increase to all other salaries. The LIST statement
totals the original salaries by job category and juxtaposes these with the new subtotals.
?DICTIONARY $mkt.dictry
OPEN employee;
DECLARE total-new (x) = (IF x > 30000 THEN total-new
+ x * 1.1
ELSE total-new + x * 1.07);
LIST BY job,
SUM (salary OVER job),
total-new (salary OVER job);
Report:
SUM TOTAL-NEW
JOB SALARY SALARY
---------- ------ ---------
ENGINEER 88000 94160.00
MANAGER 777000 854700.00
PROGRAMMER 68000 72760.00
SALESMAN 407000 442240.00
SECRETARY 155000 167350.00
SYS.-ANAL. 138000 148650.00
SYST.-ANAL. 94222 102744.20
Note that the values for total-new appear with two decimal digits. This occurs because
the arithmetic expressions contributing to the IF/THEN/ELSE expression take their
scale from the highest scale found in the expression (2, in this case). See the ENFORM
Reference Manual for more information about the scale factor.