Consultor Eletrônico



Kbase P136957: 4GL/ABL: What is the DECIMALS attribute of a buffer-field object?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   1/3/2011
Status: Verified

GOAL:

4GL/ABL: What is the DECIMALS attribute of a buffer-field object?

GOAL:

Why are my decimal field values rounded to 2 decimals even when I assign values that have three or more digits after the decimal point?

GOAL:

Why is the scale (the decimal part) of the assigned value rounded to 2 decimal places when stored in a field whose DECIMAL attribute is 2?

GOAL:

When rounding occurs on the assignment of decimal values to decimal fields?

FACT(s) (Environment):

All Supported Operating Systems
Progress 8.x
Progress 9.x
OpenEdge 10.x

FIX:

The DECIMALS attribute of a DECIMAL buffer-field object indicates the number digits to store after the decimal point. If the DECIMALS attribute is nonzero, Progress rounds off any data to be stored in the field to the specified number of decimal places before assigning he value to that field.

For example, if the DECIMALS attribute of a field is 2 and we assign the value 1.239 to the field using the ASSIGN, IMPORT or some other statement, the value 1.239 will be rounded to 2 decimal places before the rounded value of 1.24 is stored in the filed.

In short, if a valid non-negative integer DECIMALS attribute is explicitly defined for the field, the AVM rounds off any source you assign to the BUFFER-VALUE of that field to the specified number of decimal places before completing the assignment. Otherwise, the assignment executes without rounding off the source value.