Enhanced DIM Function for Arrays

The DIM function has been extended to provide a new functionality in terms of processing, searching and totaling arrays. The new syntaxes supported by the PxPlus DIM function are as follows:

DIM ( FIND MAX (array))

This syntax will find the highest value in the array provided and return its subscript.

DIM( FIND MIN (array))

This syntax will find the lowest value in the array provided and return its subscript.

DIM( FIND <array> <comparison> <expression> )

This syntax can be used to search each element in an array to locate the element which satisfies the comparison specified. For example:

DIM( FIND X${ALL} = “ABC” ) will return the first element whose value match ABC
DIM( FIND X{ALL} > 100 ) will return the first element whose value exceeds 100

If the requested condition cannot be met by any entry in the array, an error #11 will be generated.

DIM( ADD <numeric_array>)

This syntax can be used to get the total of all the elements in the array specified. It can only be used against a numeric array.


In all of the above examples, the array can be specified using {ALL} or providing a range specification as in {1:5}.

All the FIND functions are also designed to work on single dimensioned arrays and to return the index into the single dimension as there value. If used against an array with multiple dimensions, the value returned represents the physical index to the element in the array based on the number of elements present in each dimension. For example, an array that has 1:4 elements in the first dimension and 1:5 in the second has 20 total elements. The index returned in this case will be 1:5 representing 1 in the first dimension, 6:10 for 2, 11:15 for 3, and so on.