Floating Insertion Editing


Floating insertion editing is used for formatting numeric data items, 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. Floating insertion editing symbols are - currency (CS), plus (+), and minus (-).

Notes -

  • Floating insertion editing is applicable only for numeric items.
  • These symbols are counted in the size of the item.
  • The edited variable's length may differ from the same variable's length before editing.
  • All floating insertion editing symbols are mutually exclusive within one PIC string. The other two characters should not be coded if one symbol is used.

Symbols -

For numeric edited variables, use the PICTURE (or PIC) clause with the following symbols -

  • + : Plus sign used to highlight the sign of the value. If the value is negative, a minus is printed. If the value is positive, a plus is printed. It should be the first or last character in the PICTURE string.
  • - : Minus sign to highlight negative values only. If the value is negative, a minus sign is printed. If the value is positive, a space is printed instead. It should be the first or last character in the PICTURE string.
  • $ : Dollar sign insertion for currency representation. It should be the leftmost character. It may be preceded by a plus or a minus sign.

Examples -


PICTURE InputOutput
9(3)V9(2)12.3401234
$$9.9912.34$12.34
$$9.0012.34$12.00
$$,$$9.9912.34BBB$12.34
$$912.34$12
++9+127+27
++++9-157B-157
--9+127B27
----9-157B-157
Note! B represents space in the above table.

Floating insertion is especially useful when dealing with currency values in financial applications, as it allows for cleaner, more human-readable representations of amounts, especially when the value varies in length.