DecimalFloatRoundingMode IBM data server driver configuration keyword

Sets the rounding mode when working with servers that support the DECFLOAT SQL type.

Equivalent CLI keyword
DecimalFloatRoundingMode
Equivalent IBM® Data Server Provider for .NET connection string keyword
N/A
db2dsdriver.cfg configuration syntax
<parameter name="DecimalFloatRoundingMode" value="0 | 1 | 2 | 3 | 4"/>
Default setting:
0 (Half even rounding mode)
Equivalent connection attribute:
SQL_ATTR_DECFLOAT_ROUNDING_MODE
Usage notes:

The decimal float rounding mode determines what type of rounding will be used if a value is put into a DECFLOAT variable or column but the value has more digits than are allowed in the DECFLOAT data type. This can occur when inserting, updating, selecting, converting from another type, or as the result of a mathematical operation.

The value of SQL_ATTR_DECFLOAT_ROUNDING_MODE determines the decimal float rounding mode that will be used for new connections unless another mode is specified by a connection attribute for that connection. For any given connection the data server will use the same decimal float rounding mode for all action initiated as part of that connection.

When your applications are connecting to a Db2® Version 9.5 server, you must set the decimal float rounding mode on the database client to the same mode that is set on the server. If you set the decimal float rounding mode on the client to a value that is different from the decimal float rounding mode that is set on the database server, the database server will return SQL0713N on connection.

The settings correspond to these decimal float rounding modes:

  • 0 = Half even (default)
  • 1 = Half up
  • 2 = Down
  • 3 = Ceiling
  • 4 = Floor

The different modes are:

Half even (default)
In this mode the data server uses the number that will fit in the target variable and that is closest to the original value. If two numbers are equally close, they use the one that is even. This mode produces the smallest rounding errors over large amounts of data.
Half up
In this mode the data server uses the number that will fit in the target variable and that is closest to the original value. If two numbers are equally close, they use the one that is greater than the original value.
Down
In this mode the data server uses the number that will fit in the target variable and that is closest to the original value and for which the absolute value is not greater than the absolute value of the original value. You can also think of this as rounding toward zero or as using ceiling for negative values and using floor for positive values.
Ceiling
In this mode the data server uses the smallest number that will fit in the target variable and that is greater than or equal to the original value.
Floor
In this mode the data server uses the largest number that will fit in the target variable and that is less than or equal to the original value.