HP 3000 Manuals

ORD-MAX Function [ HP COBOL II/XL Reference Manual ] MPE/iX 5.0 Documentation


HP COBOL II/XL Reference Manual

ORD-MAX Function 

The ORD-MAX function returns a value that is the ordinal number of the
parameter-1 that contains the maximum value.  The function type is
integer.

Syntax 

     FUNCTION ORD-MAX ({parameter-1}...)

Parameters 

parameter-1           If more than one parameter-1 is specified, all
                      parameters must be of the same class.

Return Value 

The returned value is the ordinal number that corresponds to the position
of the parameter-1 having the greatest value in the parameter-1 series.

The comparisons used to determine the greatest valued argument are made
according to the rules for simple conditions.  See the section "Simple
Conditions" in Chapter 8  for additional information.

If more than one parameter-1 has the same greatest value, the number
returned corresponds to the position of the leftmost parameter-1 having
that value.

Example 

     77  NUM     PIC 999 VALUE ZERO.
          :
     COMPUTE NUM = FUNCTION ORD-MAX ("M", "C", "Z", "A", "M").
     DISPLAY NUM.

The above example displays the following.  The greatest value is "Z",
which is in the third position:

     003



MPE/iX 5.0 Documentation