SQL/MP Report Writer Guide

Customizing a Report
HP NonStop SQL/MP Report Writer Guide527213-001
4-17
Labeling Information
5. The column name is the default heading for a print item that is a column of a table
or view. The column name is defined when the database administrator creates the
table or view or adds the column to the table or view. To display column names,
use the INVOKE command to display a table or view definition.
6. The heading EXPR is the default heading for expressions, functions, and numeric
literals specified in the DETAIL command.
7. No heading is the default for string literals, IF/THEN/ELSE items, and CONCAT
items specified in the DETAIL command.
The following example shows how you can specify a heading for a print item in a
DETAIL command. The DETAIL command defines a heading for DEPTNUM, specifies
no heading for DEPTNAME, and accepts the default heading for LOCATION.
>> SELECT * FROM PERSNL.DEPT
+> ORDER BY DEPTNUM;
S> DETAIL DEPTNUM HEADING "DEPARTMENT",
+> DEPTNAME NOHEAD,
+> LOCATION;
S> LIST NEXT 2;
DEPARTMENT LOCATION
---------- -----------
1000 FINANCE CHICAGO
1500 PERSONNEL CHICAGO
S>
The following example specifies a heading for the concatenated names of employees:
>> SELECT * FROM PERSNL.EMPLOYEE E, PERSNL.JOB
+> WHERE E.DEPTNUM = 4000
+> AND E.JOBCODE = JOB.JOBCODE;
S> DETAIL EMPNUM HEADING "Employee No.",
+> CONCAT (FIRST_NAME STRIP, SPACE 1, LAST_NAME)
+> AS A25 HEADING "Name" CENTER,
+> JOBDESC HEADING "Job Title" CENTER ;
S> LIST N 3;
Employee No. Name Job Title
------------ ------------------------- ------------------
65 RACHEL MCKAY MANAGER
87 ERIC BROWN SYSTEM ANALYST
104 DAVID STRAND SYSTEM ANALYST
S>
The previous detail line illustrates these important points:
If the width of a heading is greater than the width of the print item value, the
heading determines the field size. A numeric value is right-justified; a character
value is left-justified. A NULL character value is left-justified.