Previous Topic: FIND FunctionNext Topic: OPSARM Function


INDEX Function

The INDEX function returns the position of the first character of string2 in string1. If string1 does not contain string2, OPS/REXX returns 0. The search for string2 begins at the first character of string1 unless you specify a startingposition for the search.

Note: Use the INDEX function in OPS/REXX or AOF rules. REXX code that uses the INDEX function invokes the TSO/E REXX version of the function when running under TSO/E.

This function has the following format:

var = INDEX(string1,string2[,startingposition])
INDEX(string1,string2)

Performs the same operation as the POS(string2,string1) function of TSO/E. For new code, use POS, not INDEX. Both functions support an optional startingposition parameter, but the first two arguments are swapped.