SQL/MP Report Writer Guide

Customizing a Report
HP NonStop SQL/MP Report Writer Guide527213-001
4-37
Formatting Data Values
CONCAT (LAST_NAME STRIP, ", ", FIRST_NAME)
or
CONCAT (FIRST_NAME STRIP, SPACE 1, LAST_NAME)
The first clause produces BENEDETTI, JULIO, and the second clause produces JULIO
BENEDETTI. You can use a similar technique to combine city and state or to combine
addresses in one field.
If you specify STRIP, the report writer strips trailing blanks from the value before
concatenating it. The default width of the concatenated item is the sum of the original
column widths before the blanks are stripped plus the width of any inserted strings.
If you want to specify the width of the field, include an AS clause in the print item:
CONCAT (FIRST_NAME STRIP, SPACE 1, LAST_NAME) AS A25
Single Items on Multiple Lines
You can print a variable-length character value that contains more characters than fit
on a single line by using the C display descriptor of the AS clause. For example,
suppose the JOB table contains a third column named JOBRESP of data type
VARCHAR, which can contain 200 single-byte characters.
In the following example, suppose the left margin is 5 and the right margin is 50. The
DETAIL line is defined as follows:
S> DETAIL JOBDESC HEADING Job Title,
+> JOBCODE HEADING Job Code, SKIP 2,
+> JOBRESP NOHEAD AS "[F]C0.45";
The JOBRESP characters start on a new line with up to 45 characters appearing on a
line. The F modifier preceding the C display descriptor specifies splitting the value at a
blank if possible. The headings and first detail line of the report are as follows:
Job Title Job Code
------------------- -----------
ENGINEER AA03
Designs and develops integrated circuits and other electronic products, assists in
planning future projects, writes specifications, and oversees product testing.
For descriptions of the C display descriptor and F modifier, see Display Format
Specifications on page 4-30.
Truncated Values
The VARCHAR_WIDTH style option specifies the maximum number of characters that
can appear in a print item with a value of a variable-length character data type. The