VALIDDATE

VALIDDATE returns a '1'B if the string d holds a date/time value that matches the pattern p.

Read syntax diagramSkip visual syntax diagram
>>-VALIDDATE-(-d--+-----------+-)------------------------------><
                  '-,p-+----+-'     
                       '-,w-'       

d
A string expression representing a date.

d specifies the input date as a character string representing date/time according to the pattern p.

d must have computational type and should have character type. If not, d is converted to character.

p
One of the supported date/time patterns.

If present, it specifies the date/time pattern of d. If p is missing, it is assumed to be the default date/time pattern of 'YYYYMMDDHHMISS999'.

p must have computational type and should have character type. If not, it is converted to character.

w
Specifies an expression (such as 1950) that can be converted to an integer. If negative, it specifies an offset to be subtracted from the value of the year when the code runs. If omitted, w defaults to the value specified in the WINDOW compile-time option.

Allowable patterns are listed in Table 2. For an explanation of Lilian format, see Date/time built-in functions.

If the pattern contains punctuation characters, VALIDDATE checks that the input string contains matching characters. For example, for the pattern YYYY-MM-DD, VALIDDATE accepts 2008-03-14 but not 2008.03.14.

Example

  dcl duedate   char(8);
  dcl (b1,b2)   bit(1);

  duedate = '19950228';
  b1 = validdate( duedate, 'YYYYMMDD' ); /* b1 = '1'b */

  duedate = '02301995';
  b2 = validdate( duedate, 'DDMMYYYY' ); /* b2 = '0'b */