The POS( ) Function

To find the position of a string in another string, use the POS( ) function. The first two arguments are:

  1. The needle to be found
  2. The haystack to be searched.

For a complete definition, see z/VM: REXX/VM Reference.

Here is a simple example:
S = "reveal"
say pos("eve",S)          /* says "2"                 */
say pos("revel",S)        /* says "0" /* not found */ */
Other useful functions of this type are LASTPOS( ) and COMPARE( ).