COBOL Manual for TNS/E Programs (H06.08+, J06.03+)

argument
is an alphabetic, alphanumeric, integer, or numeric argument. If you specify more than one
argument, they must all be of the same class. Integer and numeric arguments can be mixed,
because integers are of the class numeric.
argument can be an array; for example,
FUNCTION ORD-MIN (ARRAY1(ALL))
returns the ordinal number of the smallest element of the array ARRAY1.
The returned value is the ordinal number of the argument with the least value (according to the
rules for evaluating simple conditions). If more than one argument has the same least value, the
returned value is the ordinal number of the leftmost argument with that value. The returned value
is at least one.
Example 209 ORD-MIN Function
Code:
DATA DIVISION.
WORKING-STORAGE SECTION.
01 NUMERIC-ARRAY.
05 PICTURE 9(1) VALUE 4.
05 PICTURE 9(1) VALUE 9.
05 PICTURE 9(1) VALUE 3.
05 PICTURE 9(1) VALUE 7.
05 PICTURE 9(1) VALUE 5
01 NUM-ARRAY REDEFINES NUMERIC-ARRAY.
05 NUM OCCURS 5 TIMES PICTURE 9(1).
01 ALPHABETIC-ARRAY.
05 PICTURE X(5) VALUE "dog".
05 PICTURE X(5) VALUE "cat".
05 PICTURE X(5) VALUE "horse".
05 PICTURE X(5) VALUE "sheep".
05 PICTURE X(5) VALUE "goat".
01 ALPHA-ARRAY REDEFINES ALPHABETIC-ARRAY.
05 ALPHA OCCURS 5 TIMES PICTURE X(5).
PROCEDURE DIVISION.
DISPLAY FUNCTION ORD-MIN (NUM(ALL))
DISPLAY FUNCTION ORD-MIN (ALPHA(ALL))
DISPLAY FUNCTION ORD-MIN (NUM(1) NUM(4))
DISPLAY FUNCTION ORD-MIN (ALPHA(3) "bird" "fish")
DISPLAY FUNCTION ORD-MIN (3.4 5 6.2 9)
Output:
0000000003
0000000002
0000000001
0000000002
0000000001
PRESENT-VALUE Function
PRESENT-VALUE, a numeric function, returns a value that approximates the present value of a
specified series of future period-end amounts at a specified discount rate.
684 Intrinsic Functions