MAXIMUM function

Syntax

MAXIMUM (dynamic.array)
CALL !MAXIMUM (result, dynamic.array)

Description

Use the MAXIMUM function to return the element with the highest numeric value in dynamic.array. Nonnumeric values, except the null value, are treated as 0. If dynamic.array evaluates to the null value, null is returned. Any element that is the null value is ignored, unless all elements of dynamic.array are null, in which case null is returned.

result is the variable that contains the largest element found in dynamic.array.

dynamic.array is the array to be tested.

Examples

A=1:@VM:"ZERO":@SM:20:@FM:-25
PRINT "MAX(A)=",MAXIMUM(A)

This is the program output:

MAX(A)=20

In the following example, the !MAXIMUM subroutine is used to obtain the maximum value contained in array A. The nonnumeric value, Z, is treated as 0.

A=1:@VM:25:@VM:'Z':@VM:7
CALL !MAXIMUM (RESULT,A)
PRINT RESULT

This is the program output:

0