Summary -
In this topic, we described about the Zero Suppression and Replacement Editing with detailed example.
Suppression and replacement editing used to remove leading zeroes from the value to be edited. Zero suppression and replacement editing valid only for numeric-edited items. There are two varieties of suppression and replacement editing -
- Suppression of leading zeros and replacement with spaces.
- Suppression of leading zeros and replacement with asterisks.
The symbols Z and * are used in zero suppression editing. These 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.
The symbols (Z * + - cs) are mutually exclusive as floating replacement symbols in one PICTURE character-string. The length of the edited PICTURE clause need not be same as source PICTURE clause.
The zero suppression and replacement editing symbols are counted in the size of the item. If Z is specified, the 0 gets replaced by space. If * is specified, the 0 gets replaced by *.
Practical Example -
Scenario - Below example describes how the zero suppression and replacement editing used in COBOL programming.
Code -

----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
***************************** Top of Data ******************************
IDENTIFICATION DIVISION.
PROGRAM-ID. ZSRINEDT.
AUTHOR. MTH.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-VARS.
05 WS-VAR PIC 9(3),9(2).
05 WS-ZSRIE-VAR1 PIC ZZ,999.
05 WS-ZSRIE-VAR2 PIC ZZ,999.
05 WS-ZSRIE-VAR3 PIC ZZ,ZZ9.
05 WS-ZSRIE-VAR4 PIC ZZ,ZZ9.
05 WS-ZSRIE-VAR5 PIC **,**9.
05 WS-ZSRIE-VAR6 PIC **,**9.
05 WS-ZSRIE-VAR7 PIC **,***.
05 WS-ZSRIE-VAR8 PIC $**,**9.
05 WS-ZSRIE-VAR9 PIC **,**9.99.
PROCEDURE DIVISION.
MOVE 123.45 TO WS-VAR
WS-ZSRIE-VAR9.
MOVE 12345 TO WS-ZSRIE-VAR1.
MOVE 1234 TO WS-ZSRIE-VAR2.
MOVE 123 TO WS-ZSRIE-VAR3.
MOVE 12 TO WS-ZSRIE-VAR4.
MOVE 7891 TO WS-ZSRIE-VAR5.
MOVE 789 TO WS-ZSRIE-VAR6.
MOVE ZEROES TO WS-ZSRIE-VAR7.
MOVE 12.34 TO WS-ZSRIE-VAR8.
DISPLAY "WS-VAR: " WS-VAR.
DISPLAY "WS-ZSRIE-VAR1: " WS-ZSRIE-VAR1.
DISPLAY "WS-ZSRIE-VAR2: " WS-ZSRIE-VAR2.
DISPLAY "WS-ZSRIE-VAR3: " WS-ZSRIE-VAR3.
DISPLAY "WS-ZSRIE-VAR4: " WS-ZSRIE-VAR4.
DISPLAY "WS-ZSRIE-VAR5: " WS-ZSRIE-VAR5.
DISPLAY "WS-ZSRIE-VAR6: " WS-ZSRIE-VAR6.
DISPLAY "WS-ZSRIE-VAR7: " WS-ZSRIE-VAR7.
DISPLAY "WS-ZSRIE-VAR8: " WS-ZSRIE-VAR8.
DISPLAY "WS-ZSRIE-VAR9: " WS-ZSRIE-VAR9.
STOP RUN.
**************************** Bottom of Data ****************************
Output -
