Products Downloads


French version


 


ADELIA

VADELIA

SADELIA

WADELIA

EADELIA

(I/B)

(I/B) (C/S)

(B) (S)

(I/B) (C/S)

(B) (C/S)


Section for use

All


Syntax

LOOK_UP LogicalOperator VarId Array


Description

This instruction searches for a particular value in a one-dimensional array (it is not valid for two-dimensional arrays).


The search can be for equality, inferiority or superiority, using the logical operators =, < and > respectively.

The search argument and the array elements must be of the same length and type (numeric or alphanumeric).


To see whether the search has been executed properly, a test with the reserved word *FOUND (1 if successful, 0 if not) is necessary.

The search starts at the position relating to the index number value in the array (1 if the array is not indexed).

If the search is successful and the array is indexed, the index number will point to the array element verifying the search.

The index number is reset to 1 if the search was unsuccessful.


Example

* ARR_MONTH is an array with 12 elements:

* 1 2 3 4 5 6 7 8 9 10 11 12

* JAN FEB MAR APR MAY JUN JUL AUG SEP OCT NOV DEC

* Z_MONTH is a screen field containing the value 'MAY'


* First try, without index number

*

LOOK_UP = Z_MONTH ARR_MONTH

IF   *FOUND = '0'

PREPARE_MSG 0013 Z_MONTH

ERROR

END


* other try with an index number, used to get a corresponding value

* (in another array called ARR_VALUE)

*

N = 1

LOOK_UP = Z_MONTH ARR_MONTH(N)

IF   *FOUND = '0'

PREPARE_MSG 0013 Z_MONTH

ERROR

ELSE

RESULT = ARR_VALUE(N)

END


* other try with an index number, used to get a corresponding value

* (ARR_VALUE array)

*

N = 7

LOOK_UP = Z_MONTH ARR_MONTH(N)

* in this case, if Z_MONTH is equal to 'MAY', then *FOUND is equal to '0'

* (because N was set to 7 at first, and look-up will start at 7th element)


↑ Top of page

  • Aucune étiquette