Previous Topic

Next Topic

Book Contents

Book Index

General Information

The WORD function counts the words in the string. More than one delimiter, or type of delimiter, is allowed. The function returns the word with a position in the string corresponding to wordNum (for example, the first, fifth, or tenth word, if wordNum has the value of 1, 5, or 10, respectively).

If the specified delimiters do not exist, the entire string is considered one word.

If the specified word does not exist (for example, the fifth word was requested in a four word string), a null string (a string of length zero) is returned and the SYSRC system variable is set to 4. The result can be checked with the SYSNULL system variable (described in "SYSNULL" in Summary of System Variables). The CTB295W warning message is issued.

Note: Leading blanks are ignored even if a blank is specified as the delimiter.

Parent Topic

WORD: Functions