COBOL Manual for TNS/E Programs (H06.03+)
Intrinsic Functions
HP COBOL Manual for TNS/E Programs—520347-003
14-47
PRESENT-VALUE Function
discount-rate
is a numeric argument whose value is greater than -1.
period-end-amount
is a numeric argument.
period-end-amount can be an array; for example,
FUNCTION PRESENT-VALUE (DISCOUNT-RATE ARRAY1(ALL))
uses the elements of the array ARRAY1 as a series of numeric arguments.
The returned value is approximately
where n is the number of period-end-amount s.
Example 14-32. PRESENT-VALUE 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 N OCCURS 5 TIMES PICTURE 9V99.
01 A PICTURE S99V99.
PROCEDURE DIVISION.
MOVE FUNCTION PRESENT-VALUE (0 NUM(ALL) TO A) TO A
DISPLAY A.
MOVE FUNCTION PRESENT-VALUE (1 NUM(ALL) TO A) TO A
DISPLAY A.
MOVE FUNCTION PRESENT-VALUE (2.5 NUM(ALL) TO A) TO A
DISPLAY A.
MOVE FUNCTION PRESENT-VALUE (0 3) TO A
DISPLAY A.
MOVE FUNCTION PRESENT-VALUE (1.5 3.6 7.8 4.9) TO A
DISPLAY A.
Output:
period-end-amount
i
1 discount-rate+()
i
-----------------------------------
i 1=
n
∑










