Summary -

In this topic, we described about the Special Insertion Editing with detailed example.

Special insertion editing represents the actual decimal point for alignment purposes. Special insertion editing is valid for either numeric-edited items or external floating-point items.

The period (.) is the special insertion symbol. The period insertion symbol (.) is counted in the size of the item. The period insertion symbol (.) represents the position within the item where the actual decimal point is inserted.

Either the actual decimal point (.) or the assumed decimal point (V) must be specified in one PICTURE character-string but not both.


Practical Example -

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

Code -

Special Insertion Editing Program Code
----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
***************************** Top of Data ******************************
       IDENTIFICATION DIVISION.                                         
       PROGRAM-ID. SPINEDT.                                             
       AUTHOR. MTH.                                                     
                                                                        
       DATA DIVISION.                                                   
       WORKING-STORAGE SECTION.                                         
                                                                        
       01 WS-VARS.                                                      
          05 WS-VAR          PIC 9(5)V9(2).                             
          05 WS-SPE-VAR1     PIC 9(5).9(2).                             
          05 WS-SPE-VAR2     PIC 9999.9.                                
          05 WS-SPE-VAR3     PIC 99.99.                                 
          05 WS-SPE-VAR4     PIC 999.99.                                
                                                                        
       PROCEDURE DIVISION.                                              
                                                                        
           MOVE 00123.45     TO  WS-VAR.                                
           MOVE WS-VAR       TO  WS-SPE-VAR1                            
                                 WS-SPE-VAR2                            
                                 WS-SPE-VAR3.                           
           MOVE 1234         TO  WS-SPE-VAR4.                           
                                                                        
           DISPLAY "WS-VAR:          " WS-VAR.                          
           DISPLAY "WS-SPE-VAR1:     " WS-SPE-VAR1.                     
           DISPLAY "WS-SPE-VAR2:     " WS-SPE-VAR2.                     
           DISPLAY "WS-SPE-VAR3:     " WS-SPE-VAR3.                     
           DISPLAY "WS-SPE-VAR4:     " WS-SPE-VAR4.                     
                                                                        
           STOP RUN.                                                    
**************************** Bottom of Data ****************************

Output -

Special Insertion Editing Program Output