PRESENT-VALUE Function [ HP COBOL II/XL Reference Manual ] MPE/iX 5.0 Documentation
HP COBOL II/XL Reference Manual
PRESENT-VALUE Function
The PRESENT-VALUE function returns a value that approximates the present
value of a series of future period-end amounts specified by parameter-2
at a discount rate specified by parameter-1. The function type is
numeric.
Syntax
FUNCTION PRESENT-VALUE (parameter-1 {parameter-2}...)
Parameters
parameter-1 Must be of the class numeric; must be greater than
-1.
parameter-2 Must be of the class numeric.
Return Value
The returned value is an approximation of the summation of a series of
calculations with each term in the following form:
parameter-2
(1 + parameter-1) ** n
There is one term for each occurrence of parameter-2. The exponent n is
incremented one by one for each term in the series.
Example
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 NUM-RATE PIC S9V9999 VALUE 0.08.
01 TAB.
05 ELEMENT PIC S9999V99
OCCURS 4 TIMES VALUE ZERO.
01 NUM-P-VAL PIC S9(6)V99.
PROCEDURE DIVISION.
010-PARA.
MOVE 2012.54 TO ELEMENT (1)
MOVE 2008.29 TO ELEMENT (2)
MOVE 2015.05 TO ELEMENT (3)
MOVE 2014.87 TO ELEMENT (4)
COMPUTE NUM-P-VAL ROUNDED =
FUNCTION PRESENT-VALUE ( NUM-RATE ELEMENT (ALL) )
DISPLAY NUM-RATE
DISPLAY NUM-P-VAL.
The above example displays the following:
+0.0800
+006665.85
MPE/iX 5.0 Documentation