skip to main content

EFD Directives : DATE Directive

DATE Directive
DATE, TIME and TIMESTAMP are special field types that are not supported natively by COBOL. To use such fields, a conversion is necessary. The DATE directive defines the conversion rules.
or
or
If DateFormatString is not specified, then six-digit (or six-character) fields are retrieved as YYMMDD from the database. Eight-digit fields are retrieved as YYYYMMDD.
Format strings are the representation of the format, composed of a sequence of characters. Each character represents a digit of the COBOL field. Possible values for characters are:
The following table lists all supported DateFormatStrings:
The following table lists all supported TimeFormatStrings:
DateFormatStrings and TimeFormatStrings from the above tables can be combined together into a DateTimeFormatString. There are two types of DateTimeFormatStrings:
1.
2.
JulianDateFormatString is a serie of “J” characters. Up to eight “J” characaters are allowed. Only for iss dictionaries it is possible to specify the julian base date by setting the configuration property iscobol.compiler.iss_julian_base at compile time.
When the COBOL field contains more digits than the ones required to store the value, leading digits are set to 0. When the COBOL field contains less digits than the ones required to store the value, leading digits are truncated. When the date or time values are not complete (e.g.: a time field with hours and minutes only), they’re completed with default values by the database.
You may place the DATE directive in front of a group item, so long as you also use the USE GROUP directive.
Note: isCOBOL SQL Server requires that the number of digits in the format string matches with the number of digits of the data-item, otherwise a conversion error occurs. In addition, isCOBOL SQL Server doesn’t support hundredths of seconds (the value T in the format string), therefore they’re truncated.
Example
The next snippets show how to define the DATE-PURCHASED field as a date on the database. Note that when the field is a group item, the USE GROUP directive is used as well.
 05 DATE-PURCHASED      PIC 9(08).
 05 PAY-METHOD          PIC X(05).
The column DATE_PURCHASED will have eight digits and will be type DATE in the database, with a format of YYYYMMDD.
 05 DATE-PURCHASED.
    10 YYYY             PIC 9(04).
    10 MM               PIC 9(02).
    10 DD               PIC 9(02).
 05 PAY-METHOD          PIC X(05).

Copyright (c) 2017 Veryant
Contact us
Please share your comments on this manual or on any
Veryant product documentation with the email button at the top left