The WHEN-COMPILED special register contains the date at the start of the compilation.
WHEN-COMPILED is an alphanumeric data item that has the implicit definition:
01 WHEN-COMPILED GLOBAL PICTURE X(16) USAGE DISPLAY.
When used in nested programs, this special register is implicitly defined with the global attribute in the outermost program.
The WHEN-COMPILED special register has the format:
For example, if compilation began at 2:04 PM on 15 October 2007, WHEN-COMPILED would contain the value 10/15/0714.04.00.
WHEN-COMPILED can be used only as the sending field in a MOVE statement.
WHEN-COMPILED special register data cannot be reference-modified.
The compilation date and time can also be accessed with the intrinsic function WHEN-COMPILED (see WHEN-COMPILED). That function supports four-digit year values and provides additional information.