Environment variables / Genero environment variables |
Defines the input and display format for numeric values.
front:thousands:decimal:back
The DBFORMAT environment variable defines the input and display format for numeric values.
DBFORMAT takes precedence over DBMONEY.
DBFORMAT can be set to define the input and display format for values of these types:
DBFORMAT can specify the leading and trailing currency symbols (but not their default positions within a monetary value) and the decimal and thousands separators. The decimal and thousands separators defined by DBFORMAT apply to both monetary and other numeric data.
The instructions affected by the setting in DBFORMAT include (but are not restricted to) these items:
The asterisk ( * ) specifies that a symbol or separator is not applicable; it is the default for any front, thousands, or back term that you do not define.
If you specify more than one character for decimal or thousands, the values in the decimal or thousands list cannot be separated by spaces (nor by any other symbols). However, only the first character will be used to display numeric or currency values, when converting strings to numbers and when entering values in form fields.
Any printable character that your locale supports is valid for the thousands separator or for the decimal separator, except:
The same character cannot be both the thousands and decimal separator. A blank space (ASCII 32) can be the thousands separator (and is conventionally used for this purpose in some locales). The asterisk ( * ) symbol is valid as the decimal separator, but is not valid as the thousands separator.
The colon ( : ) symbol is supported as thousands or decimal separator but must be preceded by a backslash ( \ ) symbol, as in the specification :\::.:DM.
You must include all three colons. Enclosing the DBFORMAT specification in a pair of single quotation marks is recommended to prevent the shell from attempting to interpret (or execute) any of the DBFORMAT characters.
The setting in DBFORMAT affects how formatting masks of the FORMAT attribute and USING operator are interpreted. In formatting masks of FORMAT and USING, these symbols are not literal characters but are placeholders for what DBFORMAT specifies:
This table illustrates the results of different combinations of DBFORMAT setting and format string on the same value.
Value | Format String | DBFORMAT | Result |
---|---|---|---|
1234.56 |
$#,###.## |
$:,:.: |
$1,234.56 |
1234.56 |
$#,###.## |
:.:,:DM |
1.234,56 |
1234.56 |
#,###.##@ |
$:,:.: |
1,234.56 |
1234.56 |
#,###.##@ |
:.:,:DM |
1.234,56DM |
When the user enters numeric or currency values in fields, the runtime system behaves as follows:
When the runtime system displays or prints values:
When MONEY values are converted to character strings by the LET statement, both automatic data type conversion and explicit conversion with a USING clause insert the DBFORMAT-defined separators and currency symbol into the converted strings.
*:.:,:SFr
1234,56SFr
Here SFr stands for the Swiss Franc currency symbol. Values input by the user into a screen form are expected to contain commas, not periods, as their decimal separator because DBFORMAT has *:.:,:SFr as its setting in this example.
When using a graphical front-end, the decimal separator of the numeric keypad will produce the character defined by this environment variable.
DBFORMAT=":.:,:SFr" export DBFORMAT