[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
+---------------------------------+
|              ASCAN              |
+---------------------------------+
ASCAN(<array>, <expr> [, <expN1>
        [, <expN2>]])

-----------------------------------
Searches memory variable array for expression.
Return value - Numeric
-----------------------------------

This function searches the elements in an array for a match with a
general expression <expr>.  If a match is found the number of the
element containing <expr> is returned; if a match cannot be found 0 is
returned.

The criteria for a successful match is determined by the state (ON or
OFF) of SET EXACT.  If EXACT is SET ON, an element must match the search
expression character for character and have the same length.  If EXACT
is SET OFF and an element and search expression match up to the point
where one or the other is exhausted, the match is considered successful.
For more information on match criteria, see SET EXACT in this help
facility.

You may use the AELEMENT() function to return the proper element number
for a two-dimensional array from its row and column subscripts.

Clauses
-------

<array>
        Memory variable array to search.

<expr>
        Expression to search for.

<expN1>
        Element where search begins.

<expN2>
        Number of elements to search.

+---------------------------------+
|             Example             |
+---------------------------------+
*** SELECT or USE customer database ***
IF USED('customer')
        SELECT customer
ELSE
        USE LOCFILE('customer.dbf','DBF','Where is CUSTOMER.DBF?')
ENDIF

COUNT TO m.count

*** DIMENSION array large enough to hold data ***
DIMENSION companies[m.count,1]

COPY TO ARRAY companies FIELD company  && Fill array

m.name = 'DataTech Inc.'
m.pos  = ASCAN(companies, m.name)  && Search for company

IF m.pos != 0
        *** Company found, remove it from the array ***
        = ADEL(companies, m.pos)
        m.count = m.count - 1
ENDIF
DISPLAY MEMORY LIKE companies

-----------------------------------

See Also:  ACOPY(), ADEL(), AELEMENT(), AINS(), ASORT(), SET EXACT

-----------------------------------

See Also: ACOPY() ADEL() AELEMENT() AINS() ASORT() SET EXACT
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson