FTN95 business editing is an extension to the standard that is intended for accounting programs in which the following features are desirable:
Filling of number fields, thus preventing subsequent modification, for example when printing cheques.
Suppression of leading zeros and plus signs.
Printing of trailing minus signs (accounting convention).
Conversion of trailing minus signs to CR to indicate credit entries.
Business editing is controlled by the B edit descriptor which has the form:
B'<string>'
where <string> can contain the following characters:
+ - $ , * Z # . CR
For example:
WRITE(*,"(B'####')") 147
The field width is indicated by the number of characters in <string>. If the field width is too small for the number in question, then the output field will be filled with asterisks.
The characters have the following significance:
PLUS (+)
'FIXED SIGN': if the first character of <string> is a single plus (+),
then the actual sign of the number (+ or -) is printed as the first character
on the left in the output field.
'FLOATING SIGN': if there are multiple plus (+) signs at the beginning of <string>, then these will be replaced in the output field by printing characters and the actual sign of the number (+ or -) will be printed on the extreme left in the output field.
'TRAILING SIGN': this is the plus (+) sign on the extreme right of <string>. The actual sign (+ or -) of the number will be printed in that output field position.
MINUS (-)
This works in the same way as the PLUS sign. However, for a positive number a
blank is printed instead of '+'. This is PLUS sign suppression.
DOLLAR SIGN ($)
A DOLLAR SIGN sign may not be preceded by anything except a fixed sign. 'FIXED
DOLLAR' is a single dollar sign which will be printed in the corresponding
position in the output number.
'FLOATING DOLLAR': these are multiple dollar signs which are replaced by printing digits in the output number. A single dollar sign will be printed as the first character on the left.
ASTERISK (*)
If the output number has a digit where there is an asterisk, this digit will be
printed. Otherwise, an asterisk (*) will be printed - this is field filling. An
asterisk may be pre ceded only by a fixed sign and/or a fixed dollar.
ZED (Z)
This indicates leading zero suppression. In other words, if the digit in the
output number is a leading zero, it will not be printed and a blank space will
appear instead.
NUMBER SIGN (#)
Digit positions indicated by #'s are not subject to leading zero suppression.
COMMA (,)
If a comma occurs in the asterisk field, then a "*" will be printed.
If a comma is preceded by a significant character (which is not a sign or a
dollar sign) then a "," will be printed in the output field.
Otherwise, a blank space will be printed. Commas must follow any leading
characters and preceed decimal points.
CREDIT (CR)
The characters CR may only appear as the last two characters of <string>.
In the output "CR" will be printed following the number if it is
negative, otherwise, two blanks will be printed.
DECIMAL POINT (.)
decimal point in the output number. The only characters allowed to follow the
decimal point are #, CR or trailing signs.
The examples in the following table illustrate the use of the B edit descriptor.
Number |
B-Format |
Output |
147 |
B'####' |
0147 |
14789 |
B'####' |
**** |
0 |
B'####' |
0000 |
147 |
B'ZZZZ' |
147 |
1478 |
B'ZZZZ' |
1478 |
0 |
B'ZZZZ' |
|
0 |
B'ZZZ#' |
0 |
6.089 |
B'#.##' |
6.09 |
0 |
B'#.##' |
0.00 |
9876.34 |
B'ZZZ,ZZZ,ZZ#.##' |
9,876.34 |
987654.34 |
B'ZZZ,ZZZ,ZZ#.##' |
987,654.34 |
0 |
B'ZZZ,ZZZ,ZZ#.##' |
0.00 |
8 |
B'+###' |
+008 |
-8 |
B'+###' |
-008 |
8 |
B'-ZZ#' |
8 |
-8 |
B'-ZZ#' |
- 8 |
126 |
B'ZZZZZ+' |
126+ |
-126 |
B'ZZZZZ+' |
126- |
126 |
B'ZZZZZ-' |
126 |
-126 |
B'ZZZZZ-' |
126- |
45678 |
B'ZZZ,ZZ#CR' |
45,678 |
-45678 |
B'ZZZ,ZZ#CR' |
45,678CR |
308 |
B'+++,++#.##' |
+308.00 |
-308 |
B'+++,++#.##' |
-308.00 |
99 |
B'$ZZZZZZ#' |
$ 99 |
99 |
B'$$$$$$$#' |
$99 |
308126 |
B'$***,***,**#.##' |
$****308,126.00 |