15.3.3.3 Currency Symbols
To print a currency symbol before the first digit of a num-
ber, you must start the field with two dollar signs. If the
data contains both positive and negative numbers, you must
include a trailing minus sign.
DECLARE STRING CONSTANT FM = "$$##.##-"
PRINT USING FM, 77.44
PRINT USING FM, 304.55
PRINT USING FM, 2211.42
PRINT USING FM, -125.6
PRINT USING FM, 127.82
END
Output
$77.44
$304.55
% 2211.42
$125.60-
$127.82
Note that the dollar signs reserve places for the currency
symbol and only one digit; the dollar sign is always printed.
(Hence the warning indicator ( % ) when the third PRINT
USING statement executes.) Contrast this with the asterisk-
fill field, where BASIC prints asterisks only when there are
leading spaces.
By default, the currency symbol is a dollar sign. On
OpenVMS systems, you can change the currency symbol,
radix point, and digit separator by assigning the char-
acters you want to the logical names SYS$CURRENCY,
SYS$RADIX_POINT, and SYS$DIGIT_SEP, respectively.
If you try to print a negative number in a dollar sign field
that does not include either a trailing minus sign or the
CR and DR formatting character, BASIC signals ``PRINT
USING Format error'' (ERR=116).