Decimal point representation

Decimal points in SQL statements are represented with either periods or commas.

Two values control the representation:

  • The value of field DECIMAL POINT IS on installation panel DSNTIPF, which can be a comma (,) or period (.)
  • COMMA or PERIOD, which are mutually exclusive SQL processing options for COBOL

These values apply to SQL statements as follows:

  • For a distributed operation, the decimal point is the first of the following values that applies:
    • The decimal point value specified by the requester
    • The value of field DECIMAL POINT IS on panel DSNTIPF at the DB2® where the package is bound
  • Otherwise:
    • For static SQL statements:
      • In a COBOL program, the SQL processing option COMMA or PERIOD determines the decimal point representation for every static SQL statement. If neither SQL processing option is specified, the value of DECIMAL POINT IS at precompilation time determines the representation.
      • In non-COBOL programs, the decimal representation for static SQL statements is always the period.
    • For dynamic SQL statements:
      • If DYNAMICRULES run behavior applies, the decimal point is the value of field DECIMAL POINT IS on installation panel DSNTIPF at the local DB2 when the statement is prepared.

        For a list of the DYNAMICRULES option values that specify run, bind, define, or invoke behavior, see Table 1.

      • If DYNAMICRULES bind, define, or invoke behavior applies, and the value of installation panel field USE FOR DYNAMICRULES is YES, the decimal point is the value of field DECIMAL POINT IS.

        If bind, define, or invoke behavior applies, and field USE FOR DYNAMIC RULES is NO, the SQL processing option determines the decimal point representation. For COBOL programs, which supports SQL processing option COMMA or PERIOD, the decimal point representation is determined as described above for static SQL statements in COBOL programs. For programs written in other host languages, the default SQL processing option, which can only be PERIOD, is used.

If the comma is the decimal point, these rules apply:

  • In any context, a comma intended as a separator must be followed by a space. Such commas could appear, for example, in a VALUES clause, an IN predicate, or an ORDER BY clause in which numbers are used to identify columns.
  • In any context, a comma intended as a decimal point must not be followed by a space.
  • If the DECIMAL POINT IS field (and not the SQL processing option) determines the comma as the decimal point, DB2 will recognize either a comma or a period as the decimal point in numbers in dynamic SQL.