Display Computation


DISPLAY computation is the most used internal data representation. DISPLAY computation uses the character form. In character form, one character equals one byte (8 bits) of storage. If no usage clause is used for variables, then DISPLAY usage will be applied by default.

DISPLAY computation applies to the following data types -

  • Alphabetic
  • Alphanumeric
  • Numeric

Below table represents the storage occupied based on the number of digits in PICTURE clause –

PICTURE clauseStorage occupied
1 Digit | Char1 byte

Practical Example -


Scenario - Describes how DISPLAY computation is used in COBOL programming.

Code -

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

       DATA DIVISION. 
       WORKING-STORAGE SECTION. 
       01 WS-VAR.
          05 WS-VAR1          PIC 9(06) USAGE DISPLAY.
          05 WS-VAR2          PIC 9(06).

       PROCEDURE DIVISION. 
           DISPLAY "WS-VAR1 (DISPLAY COMPUTATION) LENGTH IS: " 
                                      LENGTH OF WS-VAR1.
           DISPLAY "WS-VAR2 LENGTH IS: "  LENGTH OF WS-VAR2.
           STOP RUN.

Output -

WS-VAR1 (DISPLAY COMPUTATION) LENGTH IS: 000000006  
WS-VAR2 LENGTH IS: 000000006

Explaining Example -

WS-VAR1 and WS-VAR2 variables are declared with 9(06). WS-VAR1 with usage DISPLAY computation and WS-VAR2 declared without DISPLAY computation, but the DISPLAY computation might applied by default. So, WS-VAR1 and WS-VAR2 have the same length when displaying length.