Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Searching for a string in a list

&pagelevel(3)&pagelevel

Recommended syntax

Syntax with lower performance

/MATCH = SEARCH-LIST-INDEX(/
LIST-VARIABLE-NAME = X,/
PATTERN = P)

/LOOP: FOR I = *COUNTER(1,SIZE('X'),1)
/ IF (INDEX(X#I,P) <> 0)
/ SET-VARIABLE MATCH = I
/ EXIT-BLOCK LOOP
/ END-IF
/END-FOR

The SEARCH-LIST-INDEX function was developed specially to improve performance. It searches through a list variable for a string or a regular expression in a call and returns the index of the first match. Using this function avoids the time-consuming search in a FOR loop.