COBOL Manual for TNS and TNS/R Programs
Intrinsic Functions
HP COBOL Manual for TNS and TNS/R Programs—522555-006
14-50
RANGE Function
RANGE Function
RANGE is a function that returns the difference between its maximum and minimum
arguments. Its type depends on the type of its arguments, as this table shows:
argument
is an integer or numeric argument. Integer and numeric arguments can be mixed,
because integers are of the class numeric.
argument can be an array; for example,
FUNCTION RANGE (ARRAY1(ALL))
returns the difference between the largest and smallest elements of the array
ARRAY1.
The returned value is the value of the greatest argument minus the value of the least
argument (where the greatest and least arguments are determined according to the
rules for evaluating simple conditions). If two arguments have the same greatest value,
the leftmost of the two is considered the greatest. If two arguments have the same
least value, the leftmost of the two is considered the least.
Argument Type Function Type
Integer Integer
Numeric (some can be integer) Numeric
( )
RANGEFUNCTION argument
VST457.vsd