COBOL Manual for TNS and TNS/R Programs

Intrinsic Functions
HP COBOL Manual for TNS and TNS/R Programs522555-006
14-63
WHEN-COMPILED Function
WHEN-COMPILED Function
WHEN-COMPILED, an alphanumeric function, returns a 21-character string that
represents the date and time the program was compiled, according to the system on
which the program was compiled.
The returned value is the date and time of compilation of the source program that calls
the WHEN-COMPILED function. If the program is a contained program, the returned
value is the date and time of the separately compiled program that contains it.
Example 14-43. VARIANCE Function
Code:
DATA DIVISION.
WORKING-STORAGE SECTION.
01 NUMERIC-ARRAY
05 PICTURE 9V99 VALUE 0.05.
05 PICTURE 9V99 VALUE 1.15.
05 PICTURE 9V99 VALUE 2.50.
05 PICTURE 9V99 VALUE 3.75.
05 PICTURE 9V99 VALUE 4.55.
01 NUM-ARRAY REDEFINES NUMERIC-ARRAY.
05 NUM OCCURS 5 TIMES PICTURE 9V99.
01 A PICTURE 9V99.
PROCEDURE DIVISION.
MOVE FUNCTION VARIANCE (NUM(ALL)) TO A
DISPLAY A..
MOVE FUNCTION VARIANCE (9 2 5 3) TO A.
DISPLAY A.
MOVE FUNCTION VARIANCE (1.5 3.6 7.8 4.9) TO A.
DISPLAY A.
MOVE FUNCTION VARIANCE (5) TO A.
DISPLAY A.
Output:
2.70
7.18
5.21
0.00
WHEN-COMPILEDFUNCTION
VST467.vsd