JSON schema with DECFLOAT(34)

In the z/OS® Connect API toolkit, when importing a Db2 native REST service with the Db2 Service Manager connection or a local schema file, one of the following errors can be displayed due to the use of DECFLOAT(34) in the JSON schema.

zosConnect-2.0 Applies to zosConnect-2.0.

  • The request / response JSON schema contains at least one field of type DECFLOAT(34) which uses minimum and maximum values that are incompatible. Update the Db2 native REST service SQL statement to CAST the field inputs to match the table column data format.
  • The imported JSON schema contains at least one field of type DECFLOAT(34) which uses minimum and maximum values that are incompatible. Update the Db2 native REST service SQL statement to CAST the field inputs to match the table column data format.

This data type is used by Db2 when both operands of a single arithmetic operator are undefined. For more information, see A launch icon to indicate a link opens a new tab or window. Determining data types of untyped expressions in the Db2 documentation.

The DECFLOAT(34) type has two problematic properties for use.
  • "minimum": -9.999999999999999999999999999999999E6144
  • "maximum": 9.999999999999999999999999999999999E6144

The displayed error can be avoided by modifying the Db2 native REST service SQL statement to use A launch icon to indicate a link opens a new tab or window. CAST specification to define the resulting type of the arithmetic operation. For example an SQL statement that contains :oneNumber - :twoNumber where neither of these operands are defined in Db2. This can be modified to be (CAST(:oneNumber AS DECIMAL) - CAST(:twoNumber AS DECIMAL)) that results in the problematic DECFLOAT(34) not being in the JSON schema. The Db2 native REST service is then imported into a Db2 service project in the API toolkit.