18. Working with Data Types and Data Display Formats : Data Display and Input Formats : Display Format Syntax
 
Share this page                  
Display Format Syntax
The display format symbols are often combined with numbers designating the character width of the field. For example, the display format f6 denotes a floating point display format containing up to six digits. Similarly, f6.2 denotes a floating point display format of up to six whole numbers and a maximum of two decimal digits.
The following table shows the format symbol, compatible data types, and syntax for each display format, and briefly describes the function of each:
Format Symbol
Data Type
Display Syntax
Display Format Description
c
character
date
[+|*|‑]c[f|j]
   [e]n[.w]
Character format, which determines the size and shape of character fields.
d
date
[+|*|‑]d
   'template'
Date template, specifying an absolute date and time or time interval.
e
decimal
float
integer
money
[+|*|‑]ew[.d]
Scientific (exponential) notation format, which displays numbers as
[‑]m.dddddE|e[+|‑]ppp
in which m represents the mantissa, d represents a digit in the fraction, and p is an exponential digit. When specifying the width of the field (w), be sure to include five spaces for E+ppp.
f
decimal
float
integer
money
[+|*|‑]fw[.d]
Floating point format, which displays a number in standard decimal format.
g
decimal
float
integer
money
[+|*|‑]gw[.d]
Displays the number in floating point format (f) if there is room; otherwise, displays it in scientific notation (e). Data is first formatted so that the decimal point will align in both f and e format. (Note that this reduces the space available for display in floating point format compared to n format). The data is then justified as specified (default is right justified).
i
decimal
float
integer
money
[+|*|‑]iw
Integer format, which displays the number as an integer.
n
decimal
float
integer
money
[+|*|‑]nw[.d]
Displays the number in floating point format (f) if there is room; otherwise, displays it in scientific notation (e). Unlike g format, data is not first formatted so that the decimal point will align in both f and e format. The data is justified as specified (default is right justified).
numeric template
decimal
float
integer
money
[+|*|‑}['{c}']
Numeric template containing character codes indicating the characters allowed in each position.
string template
c
char
text
varchar
 
String character template containing character codes indicating the characters allowed in each position.
RBF and VIFRED can use the same data display formats as Report‑Writer, with two exceptions:
B format is not allowed
Variable length format c(0) is not allowed
You can use either uppercase or lowercase letters for symbols in most data display formats. However, case can be significant in date templates (see page Date and Time Templates), numeric templates (see page Numeric Templates), and text templates (see page String Input Templates).
The following are the optional parameters you can use with the data display formats shown in the preceding table:
+|*|‑
Precedes the format letter to indicate right (+), center (*), or left (‑) justification. If no sign is used, the default is left justification for both character and numeric columns.
c
Any one of the special numeric or character template code characters allowed in that type of template. For definitions of these codes, see the sections on character and numeric templates later in this chapter.
d
Specifies the precision (the number of digits to display after the decimal point) in any of the numeric formats. To allow room in the display field for the decimal point and a plus (+) or minus (‑) sign, this number must be at least 2 less than the value of w (maximum column width).
e
When used with the wrapping character options (cfe and cje), preserves trailing white space on every line of a multi‑line text string, which is otherwise trimmed by default. If you use it with the cj format, the margin justification includes the significant white space. In some instances, this makes the text appear unjustified. For more information, see How You Create Multi-line Character Fields.
f
When used with the c format for multi‑line text strings, wraps text to the next line, with breaks occurring between words. Most useful in display‑only fields. Results in data entry fields can be unpredictable.
j
When used with the c format for multi‑line text strings, right‑justifies the text, with breaks between words, and pads the line with blanks, so that all lines end evenly at the right margin. Most useful in display‑only fields. Results in data entry fields can be unpredictable.
n
The maximum number of characters allowed in the data window.
w
When used in a character format (c) designation, specifies the number of characters displayed on each line. If n is greater than w, the data window occupies more than one line. The default of w is the value of n.
When used in a numeric format (e, f, g, i, or n), specifies the maximum column width, including all punctuation, symbols, decimal points, and decimal digits. For example, to display $15.44 the w value must be at least 6 (for example, f6.2). For columns in e, g or n format, be sure that w is wide enough for representations in scientific notation.
For example, i9 specifies an integer format nine characters wide, and +i9 specifies a right‑justified integer format nine characters wide.
To specify a floating point format for a column that is a total of nine characters wide, and for which you want to show two decimal places, enter f9.2. Allowing for the decimal point and a plus or minus sign, a display format of f9.2 permits a maximum of five digits to the left of the decimal point and two to the right of it.