Floating Insertion Editing

This type of editing is valid only for numeric-edited items. The following symbols are used:
  • Currency symbol, for example $
  • + -

Within one PICTURE character-string, these symbols are mutually exclusive as floating insertion symbols.

Floating insertion editing is specified by including two or more consecutive floating insertion symbols in the PICTURE character-string.

A currency symbol represents a currency sign, which may either be the currency symbol itself, or a currency-string one or more characters in length that is specified in the CURRENCY SIGN clause of the SPECIAL-NAMES paragraph. The size of the edited item will be increased by the number of characters contained in the corresponding currency-string for the first currency symbol present, and by a further character for each additional currency symbol in the PICTURE character-string.

If the floating insertion symbol represents a single character, the symbols are used to represent all character positions into which the corresponding character could be inserted. The leftmost floating insertion symbol in the character-string represents the leftmost limit at which the character can appear in the data item. The rightmost floating insertion symbol represents the rightmost limit at which the character can appear.

If the floating insertion symbol represents a multiple-character currency-string, the symbols are used to represent all the positions into which the final character of the currency-string could be inserted. The leftmost floating insertion symbol in the character-string represents the leftmost limit at which the final character of the currency-string can appear in the data item. The rightmost floating insertion symbol represents the rightmost limit at which the final character of the currency-string can appear.

The second leftmost floating insertion symbol in the character-string represents the leftmost limit at which numeric data can appear within the data item. Floating insertion symbols at or to the right of this limit represent numeric character positions. They may be replaced by numeric data, starting with the leading nonzero numeric character.

Any simple-insertion symbols (B 0 / ,) within or to the immediate right of the string of floating insertion symbols are considered part of the floating character-string. If the period (.) special-insertion symbol is included within the floating string, it is considered to be part of the character-string.

In a PICTURE character-string, there are two ways to represent floating insertion editing and thus, two ways in which editing is performed:
  1. Any or all leading numeric character positions to the left of the decimal point are represented by the floating insertion symbol. When editing is performed, a single floating sign insertion symbol (+ or -), or the currency sign, is placed to the immediate left of the first nonzero digit in the data, or of the decimal point, whichever is farther to the left. Any unused positions to the left of the insertion symbol or currency sign are filled with spaces.
  2. All the numeric character positions are represented by the floating insertion symbol. When editing is performed, then:
    • If the value of the data is zero, the entire data item will contain spaces.
    • If the value of the data is nonzero, the result is the same as in rule 1.
To avoid truncation, the minimum size of the PICTURE character-string must be:
  • The number of character positions in the sending item, plus
  • The number of nonfloating insertion symbols in the receiving item, plus
  • The number of characters in the floating insertion symbol.
Examples of floating insertion editing:
   PICTURE               Value of Data        Edited Result
        $$$$.99                 .123               $.12
        $$$9.99                 .12               $0.12
   $,$$$,999.99            -1234.56           $1,234.56
   U,UUU,UU9.99-           -1234.56         EUR1,234.56-
   u,uuu,uu9.99             1234.56         USD1,234.56
   +,+++,999.99          -123456.789        -123,456.78
  $$,$$$,$$$.99CR       -1234567          $1,234,567.00CR
  ++,+++,+++.+++            0000.00
Note: Beware of situations where sign truncation would lead to negative amounts being shown as credits.