Rational Developer for System z
COBOL for Windows, Version 7.5, Language Reference


DATEVAL

The DATEVAL function converts a nondate to a date field, for unambiguous use with date fields.

If the DATEPROC compiler option is in effect, the returned value is a date field containing the value of argument-1 unchanged. For information about using the resulting date field:

If the NODATEPROC compiler option is in effect, the DATEVAL function has no effect, and returns the value of argument-1 unchanged.

The function type depends on the type of argument-1:

Argument type Function type
Alphanumeric Alphanumeric
Integer Integer

Format
Read syntax diagramSkip visual syntax diagram>>-FUNCTION DATEVAL--(--argument-1--argument-2--)--------------><
 
argument-1
Must be one of the following:

The value of argument-1 represents a date of the form specified by argument-2.

argument-2
Must be an alphanumeric literal specifying a date pattern, as defined in DATE FORMAT clause. The date pattern consists of YY or YYYY (representing a windowed year or expanded year, respectively), optionally preceded or followed by one or more Xs (representing other parts of a date, such as month and day), as shown below. Note that the values are case insensitive; the letters X and Y in argument-2 can be any mix of uppercase and lowercase.
Date-pattern string Specifies that argument-1 contains
YY A windowed (two-digit) year
YYYY An expanded (four-digit) year
X A single character; for example, a digit representing a semester or quarter (1-4)
XX Two characters; for example, digits representing a month (01-12)
XXX Three characters; for example, digits representing a day of the year (001-366)
XXXX Four characters; for example, two digits representing a month (01-12) and two digits representing a day of the month (01-31)

Terms of use | Feedback

Copyright IBM Corporation 1996, 2008.
This information center is powered by Eclipse technology. (http://www.eclipse.org)