The POS( ) Function
To find the position of a string in another string, use the POS( ) function. The first two arguments are:
- The
needleto be found - The
haystackto 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( ).