SQL/MX Report Writer Guide
Customizing a Report
HP NonStop SQL/MX Report Writer Guide—527194-002
4-35
Monetary Values
You cannot specify a scale-sign descriptor for an I display descriptor.
>> SELECT P.PARTNUM, QTY_AVAILABLE, PARTCOST
+> FROM SAMDBCAT.SALES.PARTS P,
+> SAMDBCAT.INVENT.PARTSUPP PS,
+> WHERE P.PARTNUM = PS.PARTNUM
+> ORDER BY P.PARTNUM;
S> DETAIL PARTNUM HEADING 'Part No.',
+> PARTCOST AS F10.2 HEADING 'Part Cost/(dollars)',
+> PARTCOST * QTY_AVAILABLE AS '-3P F10.2'
+> HEADING 'Total Cost/(thousands/of dollars)',
+> PARTCOST * QTY_AVAILABLE AS F15.2
+> HEADING 'Total Cost/Without/Scale Factor';
S> LIST NEXT 4;
Total Cost Total Cost
Part Cost (Thousands Without
Part No. (Dollars) of Dollars) Scale Factor
-------- --------- ----------- ---------------
212 2000.00 7050.00 7050000.00
212 1900.00 6697.50 6697500.00
244 2400.00 10622.40 10622400.00
244 2200.00 9737.20 9737200.00
S>
Monetary Values
If you want to include a symbol such as the dollar sign in a monetary value, you can
use a mask or decoration to insert the symbol at the same print position on the output
line, regardless of the value of the item.
Using Masks in Display Formats
To apply a mask to insert a dollar sign, enter:
>> SELECT JOBCODE, AVG(SALARY)
+> FROM EMPLOYEE
+> GROUP BY JOBCODE;
S> DETAIL JOBCODE AS I4 HEADING 'Job',
+> COL 2 AS M<$ZZZ,ZZZ.99> HEADING 'Avg. Sal.';
S> LIST NEXT 3;
Job Avg. Sal.
---- -----------
100 $105,954.59
200 $ 24,000.00
250 $ 28,000.06
S>
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