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 a substring of a string, beginning at word n s for the number of words specified by length.
Format
@DTW_SUBWORD(stringIn, n, length, stringOut)
@DTW_SUBWORD(stringIn, n, stringOut)
@DTW_rSUBWORD(stringIn, n, length)
@DTW_rSUBWORD(stringIn, n)
Parameters
Table 108. DTW_SUBWORD Parameters
Data Type | Parameter | Use | Description |
---|---|---|---|
string | stringIn | IN | A variable or literal string. |
integer | n | IN | The word position of the first word of the substring. A null is returned if this value is greater than the number of words in stringIn. |
integer | length | IN | The number of words in the substring. If this value is greater than the number of words from n to the end of stringIn, all words to the end of stringIn are returned. The default is to return all words from n to the end of stringIn. |
string | stringOut | OUT | A variable that contains a substring of stringIn specified by n and length. |
Return Codes
Table 109. DTW_SUBWORD 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. |
Examples
Example 1:
@DTW_SUBWORD("Now is the time", "5", result)
Example 2:
@DTW_SUBWORD("Now is the time", "2", result)
Example 3:
@DTW_SUBWORD(Now is the time", "2", "2", result)
Example 4:
@DTW_rSUBWORD("Now is the time", "3")