INDEX

POS is the preferred built-in function for obtaining the position of one string in another. See page POS (Position) for a complete description.

Read syntax diagramSkip visual syntax diagram
>>-INDEX--(--haystack--,--needle--+----------+--)--------------><
                                  '-,--start-'      

returns the character position of one string, needle, in another, haystack, or returns 0 if the string needle is not found or is a null string. By default the search starts at the first character of haystack (start has the value 1). You can override this by specifying a different start point, which must be a positive whole number.

Here are some examples:
INDEX('abcdef','cd')      ->    3
INDEX('abcdef','xd')      ->    0
INDEX('abcdef','bc',3)    ->    0
INDEX('abcabc','bc',3)    ->    5
INDEX('abcabc','bc',6)    ->    0

Reference Reference

Feedback


Timestamp icon Last updated: Tuesday, 7 January 2014


http://pic.dhe.ibm.com/infocenter/cicsts/v5r1/topic/com.ibm.cics.rexx.doc//dfhrx/rvse089.html