Returns the first position in a string where a character or bit of another string appears. You can also specify the location from which to start searching.
SEARCH(x,y,z)
SEARCH returns the first position in the string x where a character or bit of the string y appears. The result is an unscaled fixed binary value. If any of these two expressions is a null string, the result is zero. If y doesn't appear in x, the result is zero.
You can also specify the location from which to start searching with the expression z.
The result precision is Fixed Binary(31) unless the -bifprec compiler option overrides it.
The SEARCH function can be used to find delimiters in a string of numbers.
dcl s char (16); dcl i fixed bin (15); s = 'Newbury, England'; i = search (s, 'ry'); /* i = 6, ‘r’ found starting from the left */
None.