SQL/MP Report Writer Guide

Customizing a Report
HP NonStop SQL/MP Report Writer Guide527213-001
4-33
Formatting Data Values
If you calculate any totals or subtotals, the mask must accommodate the resulting
values. If the previous query is modified to calculate the sum of salaries for each job
code within each department and to produce subtotals and totals, the mask must be
modified to accommodate larger numbers in the detail line, and large numbers in the
subtotal and total lines.
>> SELECT DEPTNUM, JOBCODE, SUM(SALARY)
+> FROM PERSNL.EMPLOYEE
+> ORDER BY DEPTNUM
+> GROUP BY DEPTNUM, JOBCODE;
S> DETAIL DEPTNUM AS I6 HEADING "Dept.",
+> JOBCODE AS I4 HEADING "Job",
+> COL 3 AS M<$ZZZ,ZZZ,ZZZ.99>
+> HEADING "Sum of Salaries";
S> BREAK ON DEPTNUM ;
S> SUBTOTAL COL 3 OVER DEPTNUM ;
S> TOTAL COL 3;
S> LIST ALL ;
Figure 4-15 shows the report.
Figure 4-15. Example of Monetary Total and Subtotals
.
.
.
.
.
.
.
.
.
1000 100 $ 137,000.10
500
900
$ 104,000.75
$ 19,000.00
*
$ 260,000.85
Dept.
Job
Sum of Salaries
9000 100 $ 175,500.00
900
$ 37,000.00
*
$ 212,500.00
$ 2,780,725.57
--- 34 row(s) selected.
> >
VST0415.vsd