The MAT SEARCH statement searches a numeric or string array for certain conditions. The array can be searched for the following:
The location of first element that is less than, greater than, equal to, or not equal to a given value
A count of the number of locations that are less than, etc. to a given value
The location of the maximum or minimum value in the array
The value which is the maximum or minimum value in the array
The syntax for MAT SEARCH is:
MAT SEARCH numeric-array [num-key], rule; return [,start]
MAT SEARCH string-array$ [str-key], rule; return [,start]
Where:
num-key = [search-subscripts] [DES]
str-key = [search-subscripts [sub-string]] [DES]
search-subscripts = ( {subscript|*} [,...] ) The ‘*’ must appear once.
rule = [#]LOC ([relational] value) | LOC MAX | LOC MIN | MIN | MAX
relational = < | <= | = | <> | => | >
return = variable-name
start = numeric-expression
value = string-or-numeric-expression
DES = descending search order.
The optional start value specifies the starting subscript. If not specified, searching begins with the first element for ascending searches and the last element for DEScending searches. The meaning of the search rule is: