MAX

The MAX function returns the content of the argument that contains the maximum value.

The function type depends on the argument types, as follows:

Argument Type Function Type
Alphabetic Alphanumeric
Alphanumeric Alphanumeric
National National
Index Index
All arguments integer Integer
Numeric (some arguments can be integer) Numeric
Read syntax diagramSkip visual syntax diagram
Format

                    .------------.      
                    V            |      
>>-FUNCTION MAX--(----argument-1-+--)--------------------------><

argument-1
Can be class numeric, alphanumeric, alphabetic, or DBCS, and cannot be class boolean.

If more than one argument-1 is specified, the combination of alphabetic and alphanumeric arguments is allowed. Other combinations of argument types are not allowed. For example DBCS arguments can not be mixed with alphanumeric arguments.

The returned value is the content of argument-1 having the greatest value. The comparisons used to determine the greatest value are made according to the rules for simple conditions. For more information, see Conditional Expressions.

If more than one argument has the same greatest value, the leftmost argument having that value is returned.

If the type of the function is alphanumeric or DBCS, the size of the returned value is the same as the size of the selected argument.

Related Information