Floating Insertion Editing
Floating Insertion Editing
- Floating insertion editing is used for formatting numeric variables, mainly when dealing with currency values.
- Unlike fixed insertion editing, floating insertion allows characters to "float" to the position immediately preceding the leftmost nonzero digit of the number.
- The symbols are - currency (CS), plus (+), and minus (-).
Notes -
- It is applicable only for numeric items.
- These symbols are considered as part of the data item length.
- The edited variable's length differs from the same variable's length before editing.
- All symbols are mutually exclusive within one PIC string.
Symbols -
Floating insertion editing symbols are -
- + : Plus sign is used to highlight the sign of the value. Displays a minus if the value is negative. Displays a plus sign if the value is positive. It should be the first or last character in the PICTURE string.
- - : Minus sign to highlight negative values only. Displays a minus sign if the value is negative. Displays space if the value is positive. It should be the first or last character in the PICTURE string.
- $ : Inserts dollar sign. It should be the leftmost character.
Examples -
PICTURE | Input | Output |
---|---|---|
9(3)V9(2) | 12.34 | 01234 |
$$9.99 | 12.34 | $12.34 |
$$9.00 | 12.34 | $12.00 |
$$,$$9.99 | 12.34 | BBB$12.34 |
$$9 | 12.34 | $12 |
++9 | +127 | +27 |
++++9 | -157 | B-157 |
--9 | +127 | B27 |
----9 | -157 | B-157 |
Note! B represents space in the above table.
Floating insertion is especially useful when dealing with currency values in financial applications. It is for cleaner, more human-readable representations of amount when the value varies in length.