Previous Topic Next topic Print topic


DATE

Data Format

Default and alternative date value formats vary. If using DB2 ECM, consult IBM documentation on differing formats. For OpenESQL, review the DATE and DATEDELIM SQL compiler directive option topics for more information.

For example, one supported date format is:
yyyy-mm-dd
An example value for this format is:
1994-05-24

Host Variable Formats

OpenESQL and DB2 ECM
01 date1         PIC X(10).
OpenESQL
01 date2         SQL TYPE IS DATE.
01 date3         SQL TYPE IS DATE-RECORD.
01 date4         PIC X(n).
date1 format
  • Move date data into the host variable using the form:
    MOVE "yyyy-mm-dd" TO host-var.
  • Review the DETECTDATE SQL compiler directive option topic to determine whether or not it applies to your application.
date2 format
  • Move date data into the host variable using the form:
    MOVE "yyyy-mm-dd" TO host-var.
  • Preferred format; use whenever possible.
  • Uses the DATE SQL TYPE.
  • Similar to the date1 format, but when using Enterprise Developer version 2.3 or later, never requires DETECTDATE for input host variable processing .
date3 format
Use this format when your application moves date data to host variables using ODBC escape sequences.
Note: This format is deprecated starting with Enterprise Developer version 2.3. Instead, we strongly suggest that you use the DATE and DATEDELIM SQL compiler directive options to avoid using ODBC escape sequences.
  • Move date data into the host variable using the form:
    MOVE "{d 'yyyy-mm-dd'}" TO host-var.
  • Compile applications with the DETECTDATE SQL compiler directive option to ensure that OpenESQL evaluates PIC X fields for possible time formats in input host variables.
  • Ensure n is large enough to accommodate the date value plus the characters used by the ODBC escape sequence.
  • Output host variable values are returned without the ODBC escape sequence.
date4 format
  • Move date data into host variables using these forms:
    MOVE yyyy TO host-var-year
    MOVE mm TO host-var-month
    MOVE dd to host-var-day
  • Uses the DATE-RECORD SQL TYPE.
OpenESQL .NET Managed Runtime
In addition to the definitions valid for all databases and those valid for OpenESQL, the following definition is also valid for the OpenESQL .NET Managed Runtime:
01 date5         type System.DateTime.
Previous Topic Next topic Print topic