Previous Topic: Technical Design NameNext Topic: COBOL Data Type


Implementing with Decimal Precision

COBOL store and manipulate numbers with precision. The native C, C#, or Java data types have limitations in either the number of digits or their precision. For example, most numbers with decimals are generated as a double which has a limit of 15 digits of precision, and loses precision when used in some mathematical operations.

CA Gen generate an alternative data type that can achieve precision of 18 digits. CA Gen does not generate these alternative data types by default. Rather, review your needs and determine if numeric attributes are generated in this alternative form.

Using the alternative data type consumes more CPU resources, as it uses a software library to perform the mathematical operations, whereas, the double data type uses the hardware instructions to perform the same mathematical operations.

C Language DBMS Considerations with Decimal Precision

For C generated code, CA Gen implements all attributes that are marked for decimal precision as a character string. Some DBMSs pass the string directly to the database and store it with high precision. However, other DBMSs require a double data type to store and retrieve numeric data. Therefore, limit the number of digits and precision that can be safely stored and retrieved.