ASCAN( ) Function

Example   See Also

Searches an array for an element containing the same data and data type as an expression.

Syntax

ASCAN(ArrayName, eExpression [, nStartElement [, nElementsSearched]])

Returns

Numeric

Arguments

ArrayName

Specifies the name of the array to search.

eExpression

Specifies the general expression to search for.

nStartElement

Specifies the element number at which the search begins. The element number you specify is included in the search. If you omit nStartElement, the entire array is searched by default.

nElementsSearched

Specifies the number of elements that are searched. If you omit nStartElement and nElementsSearched, the search begins with the first array element and continues to the last array element.

Note   You can refer to an element in a two-dimensional variable array in one of two ways. The first method uses two subscripts to specify the row and column position of the element in the array; the other method uses an element number. This function and others that manipulate two-dimensional arrays require element numbers (nStartElement and nElementsSearched). Use AELEMENT( ) to return the element number from row and column subscripts in a two-dimensional array.

Remarks

If a match is found, ASCAN( ) returns the number of the element containing the expression. If a match cannot be found, ASCAN( ) returns 0.

The criteria for a successful match of character data are determined by the setting of SET EXACT. If SET EXACT is ON, an element must match the search expression character for character and have the same length. If SET EXACT is OFF, and an element and search expression match until the end of the expression is reached, the match is successful. For more information on match criteria for character strings, see the string comparison table in the SET EXACT topic.