The MAX Function

The MAX function returns the content of the argument-1 that contains the maximum value. The type of this function depends upon the argument types as follows:
Argument Type Function Type
Alphabetic Alphanumeric
Alphanumeric Alphanumeric
National National
All arguments integer Integer
Numeric Numeric
(some arguments can be integer)  

General Format



  1. If more than one argument-1 is specified, all arguments must be of the same class except alphabetic and alphanumeric arguments which can be mixed.

Returned Values

  1. The returned value is the content of the argument-1 having the greatest value. The comparisons used to determine the greatest value are made according to the rules for relation conditions. See the topic Relation Condition in the chapter Procedure Division.
  2. If more than one argument-1 has the same greatest value, the content of the argument-1 returned is the leftmost argument-1 having that value.
  3. If the type of the function is alphanumeric

    MF or national

    the size of the returned value is the same as the size of the selected argument-1.

  4. If the value of argument-1 is numeric non-integer, results are returned in floating-point format.