SQL/MP Reference Manual

HP NonStop SQL/MP Reference Manual523352-013
A-65
Examples—AS
Order for Processing Decorations
SQL processes decorations from left to right:
1. Tests data to determine whether 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
Some simple uses of the AS clause:
This 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 |
Sample negative display: | <240.00>|
These are examples of decorations for negative, positive, zero, and overflow
values:
Negative value:
Positive value:
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
MAn char-string Prints at position n
MF char-string Prints immediately left of a right-justified value or
immediately right of a left-justified value
MP char-string Prints immediately right of a value
PAn char-string Prints at position n
PF char-string Prints immediately left of a value
PP char-string Prints immediately right of a value