3. Embedded QUEL for COBOL : COBOL Variables and Data Types : Data Types : The Numeric Data Category - UNIX
 
Share this page                  
The Numeric Data Category - UNIX
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 [IS]] 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, COMP-5 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 or COMP-5 item must describe a maximum of 10 digit positions with no scaling.
Do not use a picture string for INDEX 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, COMP-5 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.
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 PACKED-VAR        PIC S9(12)V9(4) USAGE COMP-3.