Summary -

In this topic, we described about the below sections -

Floating insertion editing is valid only for numeric-edited items. Floating insertion editing symbols are - currency (CS), plus (+) and minus (-).

All floating insertion editing symbols are mutually exclusive within one PICTURE character-string. If one symbol is used in a PICTURE character-string, other two symbols should not be used.

Floating insertion editing is specified by using at least two of the same allowable floating insertion symbols. For example, if plus (+) is used, then the other editing characters should also be plus (+).

Any simple-insertion symbols (B 0 / ,) within or to the immediate right of floating insertion symbols are considered part of the floating character-string.

If special-insertion symbol (.) is included within the floating string is part of the character-string. The floating insertion symbols are counted in the size of the item. The length of the edited PICTURE clause need not be same as source PICTURE clause.

Plus and minus symbols -

These symbols must appear in the leftmost or rightmost character positions. They must be the first or last character in the PICTURE string.

Minus (-) -

If the value is negative, a minus sign is printed. If the value is positive, a space is printed instead. Used to highlight negative values only.

Plus (+) -

If the value is negative, a minus is printed. If the value is positive, a plus is inserted. Used to highlight the sign of the value.

The currency symbol ($) -

The currency symbol must be the leftmost character. It may be preceded by a plus or a minus sign.

Practical Example -

Scenario - Below example describes how the floating insertion editing used in COBOL programming.

Code -

Floating Insertion Editing Program Code
***************************** Top of Data ******************************
       IDENTIFICATION DIVISION.                                         
       PROGRAM-ID. FLINEDT.                                             
       AUTHOR. MTH.                                                     
       DATA DIVISION.                                                   
       WORKING-STORAGE SECTION.                                         
       01 WS-VARS.                                                      
          05 WS-VAR          PIC 9(3)V9(2).                             
          05 WS-FLIE-VAR1    PIC $$9.99.                                
          05 WS-FLIE-VAR2    PIC $$9.00.                                
          05 WS-FLIE-VAR3    PIC $$,$$9.99.                             
          05 WS-FLIE-VAR4    PIC $$9.                                   
          05 WS-FLIE-VAR5    PIC ++9.                                   
          05 WS-FLIE-VAR6    PIC ++++9.                                 
          05 WS-FLIE-VAR7    PIC --9.                                   
          05 WS-FLIE-VAR8    PIC ----9.                                 
       PROCEDURE DIVISION.                                              
           MOVE 12.34        TO  WS-VAR                                 
           MOVE +127         TO  WS-FLIE-VAR5                           
           MOVE -157         TO  WS-FLIE-VAR6                           
           DISPLAY "WS-VAR:          " WS-VAR.                          
           DISPLAY "WS-FLIE-VAR1:    " WS-FLIE-VAR1.                    
           DISPLAY "WS-FLIE-VAR2:    " WS-FLIE-VAR2.                    
           DISPLAY "WS-FLIE-VAR3:    " WS-FLIE-VAR3.                    
           DISPLAY "WS-FLIE-VAR4:    " WS-FLIE-VAR4.                    
           DISPLAY "WS-FLIE-VAR5:    " WS-FLIE-VAR5.                    
           DISPLAY "WS-FLIE-VAR6:    " WS-FLIE-VAR6.                    
           DISPLAY "WS-FLIE-VAR7:    " WS-FLIE-VAR7.                    
           DISPLAY "WS-FLIE-VAR8:    " WS-FLIE-VAR8.                    
           STOP RUN.                                                    
**************************** Bottom of Data ****************************

Output -

Floating Insertion Editing Program Output