SQL/MP Report Writer Guide

Customizing a Report
HP NonStop SQL/MP Report Writer Guide527213-001
4-35
Formatting Data Values
The previous decoration specification assumes that all values will be positive. If you
expect negative or zero values, you must expand the decoration as shown:
AS "[MA1'CR',MPF'$',ZA1' '] F13.2"
In this clause, three decorations apply to the value:
In the first decoration, condition M specifies that this decoration applies if the
value is negative;
location A1 specifies print position 1 for printing
charstring CR.
In the second decoration, condition MP specifies that this decoration applies if
the value is negative or positive;
location and char-string are the same as
those shown in Figure 4-16
.
In the third decoration, condition Z specifies that this decoration applies if the
value is zero;
location A1 specifies print position 1 for printing char-string,
which is all blanks.
For character print items, you can specify only
condition P.
The following list shows the result of applying the preceding AS clause to different
values:
You can use the BZ modifier instead of the third decoration to specify that you want the
field left blank if the value is zero:
AS "[MA1'CR',MPF'$' BZ ] F13.2"
You can insert the European decimal character in monetary values by changing the
default decimal character. For more information, see Redefining Special Characters
on
page 4-48.
Suppressed Leading or Trailing Zeros
Leading zeros are suppressed automatically when you specify the F w. d[. m]
display descriptor and omit m. For example, F10.2 suppresses leading zeros, but
F10.2.5 prints leading zeros if the number of significant digits to the left of the decimal
point is less than 5.
Value Result
-100
CR $ 100.00
4500 $ 4500
0
Descriptor Result
F10.2 355.67
F10.2.5 00.355.67