SQL/MP Report Writer Guide

Customizing a Report
HP NonStop SQL/MP Report Writer Guide527213-001
4-31
Formatting Data Values
or too large for the field. You can specify multiple conditions. For more information
on examples of using decorations, see Monetary Values
on page 4-32.
You can specify modifiers to control justification, insert filler characters, and
specify an overflow character for the print item. A
modifier applies to a single
print item and overrides report defaults. For example, you can specify a special
overflow character for one print item and use the default OVERFLOW_CHAR
value for other print items.
Numeric Values
For numeric values, you can use the I and F display descriptors. In the following
example, QTY_RECEIVED appears in the detail line. The data type defined for
QTY_RECEIVED is NUMERIC (7); the value is always an integer. By default, the
display format is I11. The DETAIL command specifies a narrower field:
>> SELECT * FROM INVENT.PARTSUPP;
S> DETAIL PARTNUM,
+> QTY_RECEIVED AS I6 HEADING "QTY" CENTER,
+> PARTCOST * QTY_RECEIVED HEADING "TOTAL COST" CENTER;
S> LIST NEXT 2;
PARTNUM QTY TOTAL COST
------- ------ --------------------
212 20 40000.00
212 35 66500.00
S>
The following DETAIL command includes an expression in COL 4 that results in a
fixed-point number. The AS clause specifies a field 10 single-byte characters wide with
4 digits appearing to the right of the decimal point. This example uses a temporary
table created under Row Value as Percent of All Row Values
on page 3-35.
>> SELECT E.DEPTNUM, EMPNUM, SALARY, SALARY/AVGSAL*100.00
+> FROM PERSNL.EMPLOYEE E, TEMPTABS.AVGTEMP A
+> WHERE E.DEPTNUM = A.DEPTNUM;
S> DETAIL DEPTNUM, EMPNUM,
+> SALARY AS F10.2,
+> COL 4 AS F10.4 HEADING "PCT OF AVG";
S> LIST N 6;
DEPTNUM EMPNUM SALARY PCT OF AVG
------- ------ ---------- ----------
9000 1 175500.00 165.1765
1000 23 137000.00 263.4617
3000 29 136000.00 240.1766
2000 32 138000.40 276.0008
3200 39 75000.00 211.6970
3100 43 90000.00 225.8809
S>