Loading...
Select Version
The RANGE function returns a value that is equal to the value of the maximum argument minus the value of the minimum argument.
The type of this function depends upon the argument types as follows:
Argument type | Function type |
all arguments integer | integer |
Format
FUNCTION RANGE ({argument-1}...)
Argument
argument-1 must be class "numeric".
Returned values
The returned value is equal to the greatest value of argument-1 minus the least value of argument-1. The comparisons used to determine the greatest and least values are made according to the rules for simple conditions.
The error default value is
-1.
See also: MIN, MAX, MEAN, MEDIAN, MIDRANGE, ORD-MAX, ORD-MIN, SUM
Example 9-38
...
DATA DIVISION.
WORKING-STORAGE SECTION.
01 RES PIC 9(3).
PROCEDURE DIVISION.
P1 SECTION.
MAIN.
COMPUTE RES = FUNCTION RANGE (12 32 5 8 17 9).
DISPLAY RES UPON T.
STOP RUN.
Result: 027