SQL/MP Report Writer Guide
Table Of Contents
- What’s New in This Manual
- About This Manual
- 1 Introduction to the NonStop SQL/MP Report Writer
- 2 Using SQLCI and the Report Writer
- 3 Selecting Data for a Report
- 4 Customizing a Report
- Defining the Layout
- Specifying the Items in a Detail Line
- Naming Select List and Detail Line Items
- Organizing Rows Into Break Groups
- Labeling Information
- Formatting Data Values
- Formatting Dates and Times
- Using TACL to Pass Parameters
- Conditional Printing of Items or Line Entries
- Redefining Special Characters
- Calculating Totals
- Calculating Subtotals
- Printing Double-Byte Characters
- A Comparison of the Report Writer and the Enform Language
- Index
Customizing a Report
HP NonStop SQL/MP Report Writer Guide—527213-001
4-32
Formatting Data Values
In a DETAIL command print item, the AS clause must precede the HEADING and
NAME options.
In the next example, the scale-sign descriptor specifies a scale factor for a very large
number. The total cost value is scaled to thousands of dollars. The descriptor -3P
specifies a scale factor of 10** -3 (or 0.001).
You cannot specify a scale-sign descriptor for an I display descriptor.
>> SELECT P.PARTNUM, QTY_AVAILABLE, PARTCOST
+> FROM SALES.PARTS P, 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. A mask or decoration inserts the symbol at the same print
position on the output line regardless of the value of the item.
This example applies a mask to insert a dollar sign:
>> SELECT JOBCODE, AVG(SALARY)
+> FROM PERSNL.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>