form( Integer [, DecimalFormat] ) form( Integer, BitwiseFormat ) form( Enumeration, DecimalFormat )
Numeric values are formatted using the following set of format characters. Upper or lower case 'D', 'H', 'O', and 'B' characters designate the radix of the result. At least one of them must be included and they cannot be intermixed.
Integers and enumerated types can be formatted as decimal numbers. For enumerations declared as a range from zero to an upper bound, the current value the same as the corresponding integer. If an enumeration is declared a s a list of symbols then the value is the position in the list.
D A decimal digit or a space if the digit in this position is a leading or trailing 0. S A leading plus or minus sign. M A minus if the number is negative or a blanke if positive. N If a leading or trailing 0 then null; else a digit. Z If before the radix position, include leading zeros. z If after the fractional part, include trailing zeros.
Literal characters that may be interspersed in numeric forms. You can use these characters to include literals in the formatted result.
Note that a single decimal point may appear in an integer to display fixed point number. This is recommended in situations where exact representations of discrete values is required, such as accounting applications. The format for fixed point reals is the same as integers.
= The following character is a literal. _ If a lead character lead zero displays underscore; else a digit. If after radix then lead zero displays blank, else display underscore. , If after radix then lead zero displays blank; else display comma. May not be a lead character. $ Always a lead character. Lead zero displays a '$'; else a digit. When specified there must be enough room to display at least 1 $. # If follows a radix character; use as many digits as is required. If a lead character, lead zero displays a '#'; else a digit. When specified there must be enough room to display at least 1 #. . A single decimal point formats the value as a fixed point number.
IntegerFormat := EqualSpace {DecimalNumber | Character} EqualSpace Character := 'L' | 'U' | 'C' | 'l' | 'u' | 'c' EqualSpace := {('=' Printable Repeat)* | (' ' Repeat)}* Printable := ' ' to '~' Repeat := ['1' to '9' ['0' to '9']] DecimalNumber := Mantissa ['#'] ['.' [Fraction]] Mantissa := Sign ['$'] {ZeroNull [DecimalComma]} | DecimalComma Fraction := ZeroUnder {Zero | DecimalUnder | (NullUnder Null)} Sign := ['M' | 'm' | 'S' | 's'] ZeroNull := (Zero ({'_'* | ','} Zero)*) | (Null ({'_'* | ','} Null)*) DecimalComma := Decimal ({'_'* | ','} Decimal)* DecimalUnder := (Decimal '_'*)* Decimal ZeroUnder := (Zero '_'*)* NullUnder := (Null '_'*)* Decimal := {'D' | 'd'} Repeat Zero := {'Z' | 'z'} Repeat Null := {'N' | 'n'} Repeat
INTEGER EXAMPLES Form Value Quoted Result MD# 456 "456" mddd -12 "- 12" mmmd -12 " -12" 3 23 " 23" $*,**D.DD 5050 "$*,*50.50" $$,$$D.DD 10050 "$ 100.50" $$,$$D.DD 110050 "$1,100.50"
Integers can also be formatted as hexadecimal, octal, or binary numbers.
H A hexadecimal digit or a space if the value in this place is a leading 0. h A lowercase H will produce lowercase output for alphabetic digits. O o An octal digit or a space if the value in this place is a leading 0. B b A binary digit or a space if the value in this place is a lead 0. N n If a leading or trailing 0 then null; otherwise a digit. Z z If before the radix position, include leading zeros. If after the fractional part, include trailing zeros.
= The following character is a literal. _ If a lead character lead zero displays underscore; else a digit. If after radix then lead zero displays blank, else display underscore. # If follows a radix character; use as many digits as is required. If a lead character, lead zero displays a '#'; else a digit. When specified there must be enough room to display at least 1 #. Also, when used before digits a single pound is treated as a literal. This useful to include a prefix indicating the radix (#, 2#, 8#).
BitwiseFormat := EqualSpace ['#'] {ZeroUnder | NullUnder} BitwiseRadiax EqualSpace BitwiseRadix := {HexRadix | OctalRadix | BinaryRadix} ['#'] HexRadix := Hex ('_'* Hex)* OctalRadix := Octal ('_'* Octal)* BinaryRadix := Binary ('_'* Binary)* Hex := {'H' | 'h'} Repeat Binary := {'B' | 'b'} Repeat Octal := {'O' | 'o'} Repeat