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, Micro Focus XDBC can respond properly.
$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 |
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. Micro Focus XDBC defaults the month and day to 1, so that incomplete types will be valid. Note thatMicro Focus XDBC can handle incomplete date types, but if you have a complete type and invalid date data, Micro Focus XDBC cannot handle the date.