3. Embedded SQL for COBOL : COBOL Data Items and Data Types : Data Types : Numeric Edited Data Category
 
Share this page                  
Numeric Edited Data Category
The syntax for a declaration of numeric edited data is:
level-number data-name PIC [IS] pic-string [[USAGE [IS]]DISPLAY]
Syntax Notes:
The pic-string can be any legal COBOL picture string for numeric edited data. Embedded SQL notes only the type, scale, and size of the data item.
To interact with Ingres integervalued objects, the picture string must describe a maximum of 10 digit positions with no scaling.
While you can use numeric edited data items to assign data to, and receive data from, Ingres database tables and forms, be prepared for some loss of precision for numeric edited data items with scaling. The runtime interface communicates by integer (COMP) or uses packed (COMP3) for UNIX or uses float (COMP2) for VMS variables. In moving from these variables into your program's edited data items, truncation can occur due to MOVE statement rules and the COBOL standard alignment rules. For more information on type conversion, see Data Type Conversion (see page Data Type Conversion) in this chapter.
Example: Numeric edited data category usage
01 DAILY-SALES   PIC $$$,$$9DB USAGE DISPLAY.
01 GROWTH-PERCENT  PIC ZZZ.9(3) USAGE DISPLAY.