COBOL Numeric Data type

COBOL Value Clause COBOL Alphabetic Data Type

Numeric data type name is self explanatory which will allow storing a combination of 0 to 9 numbers.

If any data item declared as Numeric, then it will store the data which included 0-9 numbers that are used in the program.

Numeric data type uses 9 to declare the numeric data item.

The max length of numeric data type is 18. i.e. PIC 9(18).

NUMERIC data type declaration can be with a combination of other data types like V(Virtual decimal point),P(decimal point) and S(Sign).

All USAGE clauses are applicable for Numeric data type.

Below example to display the constant value with two variable of smaller length and larger length than actual constant length

Practicle Example:

IDENTIFICATION DIVISION.                                         
PROGRAM-ID. NUMERICJ.                                            
DATA DIVISION.                                                   
WORKING-STORAGE SECTION.                                         
01 NUMERIC-J1                PIC 9(03).                          
01 NUMERIC-J2                PIC 9(09).                         
PROCEDURE DIVISION.                                              
    MOVE '256128'     TO NUMERIC-J1                              
    DISPLAY '                      ***NUMERIC DISPLAY***'.       
    DISPLAY 'NUMERIC-J1  : 'NUMERIC-J1.                          
    DISPLAY 'NUMERIC-J2  : 'NUMERIC-J2.                          
    STOP RUN.                                                    

COBOL Value Clause COBOL Alphabetic Data Type