Controlling date processing explicitly

There might be times when you want COBOL data items to be treated as date fields only under certain conditions or only in specific parts of the program. Or your application might contain two-digit-year date fields that cannot be declared as windowed date fields because of some interaction with another software product.

About this task

For example, if a date field is used in a context where it is recognized only by its true binary contents without further interpretation, the date in that field cannot be windowed. Such date fields include:

  • A key in an SdU file
  • A search field in a database system such as Db2®
  • A key field in a CICS® command

Conversely, there might be times when you want a date field to be treated as a nondate in specific parts of the program.

COBOL provides two intrinsic functions to deal with these conditions:

DATEVAL
Converts a nondate to a date field
UNDATE
Converts a date field to a nondate

Related tasks  
Using DATEVAL  
Using UNDATE