COBOL Manual for TNS and TNS/R Programs
Intrinsic Functions
HP COBOL Manual for TNS and TNS/R Programs—522555-006
14-64
WHEN-COMPILED Function
The returned value represents the current date this way (where character position 1 is 
the leftmost character position): 
The returned value matches the compilation time and date on the listing and object 
code files (if they have it), but the representation and precision may differ.
The date in Example 14-44 is April 15, 1997 (19970415). The time is 16:10:49.53 or 
4:10:49.53 PM (16104953), which is 7 hours behind Greenwich mean time (-0700).
Character 
Positions Date Part Represented Represented by
1-4 Year in Gregorian calendar Four digits
5-6 Month of the year Two digits in the range 01 through 12
7-8 Day of the month Two digits in the range 01 through 31
9-10 Hours past midnight Two digits in the range 00 through 23
11-12 Minutes past the hour Two digits in the range 00 through 59
13-14 Seconds past the minute Two digits in the range 00 through 59
15-16 Hundredths of seconds past the 
second
Two digits in the range 00 through 99
17 Relationship to Greenwich mean 
time
Minus (-) if the reported time is behind 
Greenwich mean time, plus (+) if it is the 
same as or ahead of Greenwich mean 
time
18-19 Hours behind or ahead of 
Greenwich mean time
If character position 17 is minus (-), two 
digits in the range 00 through 12; if 
character position 17 is plus (+), two 
digits in the range 00 through 13
20-21 Additional minutes from 
Greenwich mean time
Two digits in the range 00 through 59
Example 14-44. WHEN-COMPILED Function
Code:
DISPLAY FUNCTION WHEN-COMPILED
Output:
1997041516104953-0700










