User Tools

Site Tools


numeric_and_currency_pictures.htm
Navigation:  Language Reference > 3 - Variable Declarations > Picture Tokens >====== Numeric and Currency Pictures ====== Previous pageReturn to chapter overviewNext page

@N [currency] [sign] [fill] size [grouping] [places] [sign] [currency] [B]

blk2blue.jpg

@N All numeric and currency pictures begin with @N.
currency Either a dollar sign ($) or any string constant enclosed in tildes (~). When it precedes the sign indicator and there is no fill indicator, the currency symbol “floats” to the left of the high order digit. If there is a fill indicator, the currency symbol remains fixed in the left-most position. If the currency indicator follows the size and grouping, it appears at the end of the number displayed.
sign Specifies the display format for negative numbers. If a hyphen ( - ) precedes the fill and size indicators, negative numbers will display with a leading minus sign. If a hyphen follows the size, places, and currency indicators, negative numbers will display with a trailing minus sign. If parentheses are placed in both positions, negative numbers will be displayed enclosed in parentheses. To prevent ambiguity, a trailing minus sign should always have grouping specified.
fill Specifies leading zeros, spaces, or asterisks (*) in any leading zero positions, and suppressesdefault grouping. If the fill is omitted, leading zeros are suppressed.
0 (zero) Produces leading zeroes
_ (underscore) Produces leading spaces
* (asterisk) Produces leading asterisks
size The size is required to specify the total number of significant digits to display, including the number of digits in the places indicator and any formatting characters.
grouping A grouping symbol, other than a comma (the default), can appear right of the size indicator to specify a three digit group separator.

. (period) Produces periods
_ (underscore) Produces spaces
places Specifies the decimal separator symbol and the number of decimal digits. The number of decimal digits must be less than the size. The decimal separator may be a period (.), grave accent (' ) (produces periods grouping unless overridden), or the letter “v” (used only for STRING field storage declarations–not for display).

. (period) Produces a period
` (grave accent) Produces a comma
v Produces no decimal separator
B Specifies blank display whenever its value is zero.

The numeric and currency pictures format numeric values for screen display or in reports. If the value is greater than the maximum value the picture can display, a string of pound signs (#) is displayed.

Example:

Numeric Result     Format

@N9      4,550,000  Nine digits, group with commas (default)

@N_9B    4550000    Nine digits, no grouping, leading blanks if zero

@N09     004550000  Nine digits, leading zero

@N*9     *45,000  Nine digits, asterisk fill, group with commas @N9_     4 550 000  Nine digits, group with spaces @N9.     4.550.000  Nine digits, group with periods Decimal Result     Format @N9.2    4,550.75   Two decimal places, period decimal separator @N_9.2B  4550.75    Two decimal places, period decimal separator, no grouping, blank if zero @N_9`2   4550,75    Two decimal places, comma decimal separator @N9.`2   4.550,75   Comma decimal separator, group with periods @N9_`2   4 550,75   Comma decimal separator, group with spaces Signed   Result     Format @N-9.2B  -2,347.25  Leading minus sign, blank if zero @N9.2-   2,347.25-  Trailing minus sign @N(10.2) (2,347.25) Enclosed in parens when negative Dollar Currency   Result     Format @N$9.2B    $2,347.25   Leading dollar sign, blank if zero @N$10.2-   $2,347.25-  Leading dollar sign, trailing minus when negative @N$(11.2)  $(2,347.25) Leading dollar sign, in parens when negative International NOTE: With the implementation of the Euro, many of these symbols are now obsolete. Currency     Result       Format @N12_`2~ ' ~  1 5430,50 '   Euro @N12_`2~ F~   1 5430,50 F   France @N~L. ~12`    L. 1.430.050  Italy @N~£~12.2     £1,240.50     United Kingdom @N~kr~12`2    kr1.430,50    Norway @N~DM~12`2    DM1.430,50    Germany @N12_`2~ mk~  1 430,50 mk   Finland @N12`2~ kr~   1.430,50 kr   Sweden Storage-Only Pictures: Variable1 STRING(@N_6v2)           !Declare as 6 bytes stored without decimal CODE Variable1 = 1234.56               !Assign value, stores '123456' in file MESSAGE(FORMAT(Variable1,@N_7.2)) !Display with decimal point: '1234.56'**

numeric_and_currency_pictures.htm.txt · Last modified: 2021/04/15 15:57 (external edit)