Fmt: Difference between revisions

From BR Wiki
Jump to navigation Jump to search
(Created page with "The FMT (format) specification is supported for use with FIELDS processing for validating and formatting of entered string or numeric data. It is similar to PIC as used fo...")
 
No edit summary
Line 3: Line 3:
One of the advantages of FMT is that it handles simple error checking of entered data (beeping when any character entered is in the wrong format) and it can fully format a field for input by forcing uppercase/lowercase, flush right and zero fill formatting. Another advantage is that it can display a single field (from the programmer's perspective) as two or more fields for the user.
One of the advantages of FMT is that it handles simple error checking of entered data (beeping when any character entered is in the wrong format) and it can fully format a field for input by forcing uppercase/lowercase, flush right and zero fill formatting. Another advantage is that it can display a single field (from the programmer's perspective) as two or more fields for the user.


;FMT Vs PIC
{{:FMT vs PIC}}
{{:FMT vs PIC}}



Revision as of 02:19, 21 February 2013

The FMT (format) specification is supported for use with FIELDS processing for validating and formatting of entered string or numeric data. It is similar to PIC as used for screen I/O, but more powerful, and more suited to use with strings.

One of the advantages of FMT is that it handles simple error checking of entered data (beeping when any character entered is in the wrong format) and it can fully format a field for input by forcing uppercase/lowercase, flush right and zero fill formatting. Another advantage is that it can display a single field (from the programmer's perspective) as two or more fields for the user.

FMT Vs PIC

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.