z/OS TSO/E REXX Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


POS (Position)

z/OS TSO/E REXX Reference
SA32-0972-00

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

returns the position of one string, needle, in another, haystack. (See also the INDEX and LASTPOS functions.) Returns 0 if needle is the null string or is not found or if start is greater than the length of haystack. By default the search starts at the first character of haystack (that is, the value of start is 1). You can override this by specifying start (which must be a positive whole number), the point at which the search starts.

Here are some examples:
POS('day','Saturday')       ->    6
POS('x','abc def ghi')      ->    0
POS(' ','abc def ghi')      ->    4
POS(' ','abc def ghi',5)    ->    8

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014