AIX | HP-UX | Linux | OS/2 | OS/390 | OS/400 | PTX | SUN | Win NT |
X | X | X | X | X | X | X | X | X |
Purpose
Returns the word number of the first occurrence of one string within another.
Format
@DTW_WORDPOS(stringIn1, stringIn2, n, stringOut)
@DTW_WORDPOS(stringIn1, stringIn2, stringOut)
@DTW_rWORDPOS(stringIn1, stringIn2, n)
@DTW_rWORDPOS(stringIn1, stringIn2)
Parameters
Table 116. DTW_WORDPOS Parameters
Data Type | Parameter | Use | Description |
---|---|---|---|
string | stringIn1 | IN | A variable or literal string. |
string | stringIn2 | IN | A variable or literal string to search. |
integer | n | IN | The word position in stringIn2 to begin searching. If this value is larger than the number of words in stringIn2, 0 is returned. The default is to search from the beginning of stringIn2. |
string | stringOut | OUT | The word position of stringIn1 in stringIn2. |
Return Codes
Table 117. DTW_WORDPOS Return Codes
Return Code | Explanation |
---|---|
-1001 | The server could not process a Net.Data request to allocate memory. |
1001 | An input parameter contained a NULL value. |
1003 | An incorrect number of parameters were passed on a function call. |
1005 | A parameter passed on a function call, required to be a string variable, was of a different variable type. |
1006 | A literal string was passed on a function call for a parameter which was required to be an output parameter. |
1007 | A parameter contains a value which is not valid. |
Usage Notes
Multiple blanks are treated as single blanks for comparison.
Examples
Example 1:
@DTW_WORDPOS("the", "Now is the time", result)
Example 2:
@DTW_WORDPOS("The", "Now is the time", result)
Example 3:
@DTW_WORDPOS("The", "Now is the time", "5", result)
Example 4:
@DTW_WORDPOS("is the", "Now is the time", result)
Example 5:
@DTW_rWORDPOS("be", "To be or not to be", "3")