Sign Data Type Example


Scenario - Displaying a value with Positive Sign.

Code -

----+----1----+----2----+----3----+----4----+----5----+
       IDENTIFICATION DIVISION.
       PROGRAM-ID. SIGNDT.
       AUTHOR. MTH.

       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01 WS-SIGN-DIS     PIC S9(5) VALUE +10000.

       PROCEDURE DIVISION. 
   
           DISPLAY "WS-SIGN-DIS:   " WS-SIGN-DIS.
           STOP RUN.

Output -

WS-SIGN-DIS:   1000{

Explaining Example -

In the above example:

  • It defines a variable named WS-SIGN-DIS of type signed numeric with a total of 5 digits, with a default value of +10000. It then displays the value as 1000{. + sign overpunches on 0. So the symbol { is displayed.