Specifying date and time routines

During Db2 installation, you can establish a date routine or time routine.

Procedure

Begin program-specific programming interface information.To specify date and time routines:

  1. Set LOCAL DATE LENGTH or LOCAL TIME LENGTH to the length of the longest field that is required to hold a date or time in your local format.

    Allowable values range in the range 10–254. For example, if you intend to insert and retrieve dates in the form September 21, 2006, you need an 18-byte field. You would set LOCAL DATE LENGTH to 18.

  2. Replace all of the IBM®-supplied exit routines.
    Use CSECTs DSNXVDTX, DSNXVDTA, and DSNXVDTU for a date routine, and DSNXVTMX, DSNXVTMA, and DSNXVTMU for a time routine. The routines are loaded when Db2 starts.
  3. To make the local date or time format the default for retrieval, set DATE FORMAT or TIME FORMAT to LOCAL when installing Db2.

    This specification has the effect that Db2 always takes the exit routine when you retrieve from a DATE or TIME column. For example, suppose that you want to retrieve dates in your local format only occasionally; most of the time you use the USA format. You would set DATE FORMAT to USA.

What to do next

The installation parameters for LOCAL DATE LENGTH, LOCAL TIME LENGTH, DATE FORMAT, and TIME FORMAT can also be updated after Db2 is installed. If you change a length parameter, you might need to rebind the applications.

End program-specific programming interface information.