WORDX – Extend the REXX WORD function

This function extends the REXX WORD function to enable you delimit words with characters different from a blank. As with the WORD function, the leading delimiters are ignored and consecutive delimiters treated as one, returning the number of delimited word. If the number is greater than the number of words, a null string is returned. The input string must not contain the “00”x character.

WORDX(<string>,<delimiter>,<number>)
Where:
<string>
The string from which to extract the words.
<delimiter>
The delimiter with which to separate each word.
<number>
The word number to return,
For example, the following command returns "FOUR":
WORDX(“FIVE!FOUR!THREE!TWO!ONE”,”!”,2)
The following command returns "B":
WORDX(“.A.B..C.D”,”.”,2)
The following command returns "":
WORDX(“.A.B..C.D”,”.”,5) returns “”