DATE directive

The DATE directive creates a map between the ODBC/JDBC application date fields and COBOL numeric fields. Because there's no COBOL syntax that identifies a field as a date, you should add this directive to differentiate dates from other numbers. This way, when a user of a Windows or Java application requests date information, AcuXDBC can respond properly.


$XFD DATE[=date-format-string optional]


*(( XFD DATE[=date-format-string optional]))

The DATE directive implies the NUMERIC directive.

The date-format-string is a description of the desired date format, composed of characters from the following list:

Y     year (2- or 4-digit)
M month (01 to 12)
D day of month (01 to 31)
J Julian day (00000000 to 99999999)
E day of year (001 to 366)
H hour (00 to 23)
N minute
S second
T hundredth of a second
  • If date-format-string contains only date characters (Y, M, D, E, or J), the string is treated as a DATE variable
  • If date-format-string contains only time characters (H, N, S), it is treated as a TIME variable
  • If date-format-string contains any combination of date and time characters, or if it contains fractional seconds (T), it is treated as a TIMESTAMP variable
Note: Some applications have difficulty processing a date-format-string that contains fractional seconds (for example: HHNNSSTT). If you are using such an application, modify strings containing fractions to be purely numeric.

Each character in a date-format-string can be considered a placeholder that represents the type of information stored at that location. The characters also determine how many digits will be used for each type of data. Any other characters cause the date-format-string to be invalid. Invalid formats are automatically treated as numeric data.

For example, although you would typically represent the month with two digits, if you specify MMM as part of your date format, the resulting date uses three digits for the month, left-zero-filling the value. If the month is given as M, the resulting date uses a single digit and truncates on the left.

If you don't specify a date-format-string, the default is YYMMDD if the field has six digits, or YYYYMMDD if the field has eight digits.

Sometimes it's desirable to have incomplete date types, for example, to have YYYYMM to simply store the year and month. AcuXDBC defaults the month and day to 1, so that incomplete types will be valid. Note thatAcuXDBC can handle incomplete date types, but if you have a complete type and invalid date data, AcuXDBC cannot handle the date.