FMT vs PIC

From BR Wiki
Jump to navigation Jump to search

With some exceptions, FMT is best suited to handling strings, whereas PIC is generally used with numeric data only. See the chart below comparing the two:

FMT Syntax


The FMT spec can be used in the same places that PIC is allowed in INPUT FIELDS, RINPUT FIELDS and PRINT FIELDS statements. The FMT keyword must be followed by up to 40 character identifiers and/or insertion characters.

Character identifiers tell the system which characters are allowed in the current position, and they identify the way in which the data part should be formatted for input. (Business Rules considers any section of a FMT spec, which is separated from other sections by one or more insertion characters to be a data part.) The following character identifiers are currently available:

9 Allow any number from 0 to 9.
a Allow any character from A to Z or a to z, and leave case as entered.
G Allow any character from A to Z, a to z, or 0 to 9, and force it to upppercase if its alphabetic.
g Allow any character from A to Z, a to z, or 0 to 9, and force it to lowercase if its alphabetic.
P or p Protected. Business Rules will not allow the cursor to rest on or change any data that is displayed in this position
R Mimic the next character specification. Right flush this part from current position to the end of this part (preceding next R or #), process according to the next character identifier within this part (if R is the only character type used, error 0805 will result).
X Allow any character and force to uppercase if its alphabetic.
x Allow any character and force to lowercase if its alphabetic.
Y Allow only Y, y, N, or n, and force it to uppercase.
y Allow only Y, y, N, or n, and force it to lowercase.
# Mimic the next character specification. Right flush and zero fill from current position to end of this part (preceding next R or #), process according to the next character identifier within this part (if # is the only one used, error 0805 will result).


Insertion characters are displayed exactly as they appear in the FMT specification. Business Rules treats any keyboard character that is not a character identifier (listed above) as an insertion character.

Insertion characters are inserted for the operator's benefit. They will not be in the data. Note that "P" can be used to protect characters that you want to appear in the data.