MIN
Returns the minimum integer value from an input argument list.
Type
Dialog Language function
Format
MIN(result &arg1 &arg2 [&arg3] . . . [&argn]) - result
- The name of a variable to be updated with the result. &arg1-&argn are compared and the minimum integer value is placed in result. If any errors occur the variable is not updated.
- &arg1
- The first integer variable for comparison
- &arg2
- The second integer variable for comparison
- &arg3-n
- The 3rd through nth integer variables for comparison
Return Codes
- 0
- &arg1-&argn were compared, and the smallest value was returned in result.
- 4
- result was omitted or is an invalid variable name.
- 8
- A non-numeric value was passed for compare. Ensure that &arg1-&argn are not null and contain valid integer numbers, between -2,147,483,648 and 2,147,483,647, inclusive.
Example
The following example uses MIN
to set &Minval to 5:
.
.
.
)declare
Var1 scope(local) * expression string
Var2 scope(local) * expression string
rc scope(local) * return code from MIN
Minval scope(local) * result minimum
.
.
.
set Var1 5
set Var2 8
set rc (min(Minval &Var1 &Var2))