NonStop SQL/MP Reference Manual

Table Of Contents
NonStop SQL/MP Reference Manual142115
A-60
Examples—AS
Rules for Using Decorations
Specify decorations immediately before the descriptors they modify. Enclose the
decorations and the modified descriptors in quotation marks (“”).
Separate multiple decorations by commas and enclose decorations and modifiers in
brackets.
With the overflow condition (O), use only the form location An.
The default overflow character is the current OVERFLOW_CHAR option.
Decoration OC overrides the default but does not change it.
A print position is one byte; each double-byte character requires two print positions.
Without decorations, a negative value prints with a preceding minus. If you specify
a decoration that tests for a positive value, however, the preceding minus is no
longer the default for negatives; you must explicitly request the negative sign.
Order for Processing Decorations
SQL processes decorations from left to right, as follows:
1. Tests data to determine if it is positive, negative, or zero.
2. If the P location is specified, adds the character string to the item value.
3. Formats according to the A, I, or F descriptor.
4. Applies decorations for alphanumeric and fixed-point descriptors.
5. Tests for overflow.
Examples—AS
The following are some simple uses of the AS clause:
The following AS clause displays a dollar value, enclosing the value in angle
brackets if the value is negative:
QTYCOST AS "[MF'<',MP'>',ZPP' '] (-3P F10.2)"
Sample positive display: | 46983.00 |
CUSTNAME AS “[RJ] A24” Displays CUSTNAME right justified in a 24-byte
field
CUSTNAME AS A24 Displays CUSTNAME left justified in a 24-byte
field
PRICE AS “-2P F6.0” Displays PRICE in a 6-byte field with a scale of
minus 2 and no digits to the right of the decimal
JOBDESC AS “[F] C18.10” Displays an 18-byte varying-length character
column as ten bytes per line, breaking lines at
blanks if possible