3. Embedded QUEL for COBOL : COBOL Variables and Data Types : Data Types : The Numeric Data Category - VMS
 
Share this page                  
The Numeric Data Category - VMS
EQUEL/COBOL accepts the following declarations of numeric variables:
level-number data-name PIC [ISpic-string [USAGE [IS]] 
    COMP|COMP-3|COMP-5 |DISPLAY.
level-number data-name [USAGE [ISCOMP-1|COMP-2| INDEX. 
Syntax Notes:
Use the symbol "S" on numeric picture strings to indicate the presence of an operational sign.
The picture string (pic-string) of a COMP, COMP-3 data item can contain only the symbols "9", "S", and "V" in addition to the parenthesized length.
In order to interact with Ingres integer-valued objects, the picture string of a COMP, COMP-3, or DISPLAY item must describe a maximum of 10 digit positions with no scaling.
Do not use a picture string for INDEX, COMP-1, or COMP-2 data items. While the preprocessor ignores such a picture string, the compiler does not allow it.
You can use any data items in the numeric category to assign and receive Ingres numeric data in database tables and forms. However, you can only use non-scaled COMP, COMP-3, and DISPLAY items of 10 digit positions or less to specify simple numeric objects, such as table field row numbers. Generally, try to use COMP data items with no scaling to interact with Ingres integer-valued objects, since the internal format of COMP data is compatible with Ingres integer data.
Similarly, COMP-1 and COMP-2 data items are compatible with Ingres floating-point data.
Ingres effects the necessary conversions between all numeric data types, so the use of DISPLAY and COMP-3 scaled data items is allowed. For more information on type conversion, see Data Type Conversion.
The following example contains numeric data categories:
##  01 QUAD-INTVAR        PIC S9(10) USAGE COMP.
##  01 LONG-INTVAR        PIC S9(9) USAGE COMP.
##  01 SHORT-INTVAR       PIC S9(4) USAGE COMP.
##  01 DISPLAY-VAR        PIC S9(10) USAGE DISPLAY.
##  01 SING-FLOATVAR     USAGE COMP-1.
##  01 DOUB-FLOATVAR     USAGE COMP-2.
##  01 PACKED-VAR         PIC S9(12)V9(4) USAGE COMP-3.