Format

Element Name

FORMAT name <C_Format_String {\switch}* | non_C_format_string>

Description

The C_format_string is formated as follows:

Instructs Post to assign the C_Format_String to the format named name. This name (and its format) can be assigned to an Address and will be used by Post to format the output of that Address. If the C_Format_String contains an s the value of the Address is treated as a string; if it contains a d the value is treated as an integer; if it contains a f or g the value is treated as a double. For a complete definition of the format of a C_Format_String see a recent C language book, e.g., C A Reference Manual, by Harbison, S.P. and Steele, G.L. Jr., Prentice Hall, N.J.

The non_C_format_string is formated as follows:

FORMAT <name> &abcdef

where:

a = + or _

+ means to output a '+' as the first character if the number is greater than zero.

_ means do not output as a '+'.

b = 0 or _

0 means to zero-fill the integer output to a length of 'c'.

_ means do not output to a length of 'c'..

c = {0, 1, 2, ..., 9}

The maximum number of integer positions to output. If the value to output exceeds this limit, it is output and an ERROR is raised. If zero-fill is specified (position b) then zeros are left filled to length 'c'.

d = . or _

If '.' then output a decimal point otherwise don't.

e = {0,1,2, ..., 9}

The maximum number of fractional (to the right of the decimal point) positions to output. If the digit immediately to the right of the e digit is 5 or more then 1 is added to the e digit.

f = 0 or _

0 means to zero fill the fractional output to a length of 'e'. Exception: if 'e' is greater than 0 (i.e., a real format) and the value of the number to be output is zero then 0.0 is output regardless of the specified format.

Example

FORMAT Socket_2 "%02d"