AIX | HP-UX | Linux | OS/2 | OS/390 | OS/400 | PTX | SUN | Win NT |
X | X | X | X | X | X | X | X | X |
Purpose
Inserts a string into another string starting after the nth character.
Format
@DTW_INSERT(stringIn1, stringIn2, n, length, pad, stringOut)
@DTW_INSERT(stringIn1, stringIn2, n, length, stringOut)
@DTW_INSERT(stringIn1, stringIn2, n, stringOut)
@DTW_INSERT(stringIn1, stringIn2, stringOut)
@DTW_rINSERT(stringIn1, stringIn2, n, length, pad)
@DTW_rINSERT(stringIn1, stringIn2, n, length)
@DTW_rINSERT(stringIn1, stringIn2, n)
@DTW_rINSERT(stringIn1, stringIn2)
Parameters
Table 84. DTW_INSERT Parameters
Data Type | Parameter | Use | Description |
---|---|---|---|
string | stringIn1 | IN | A variable or literal string to be inserted into stringIn2. |
string | stringIn2 | IN | A variable or literal string. |
integer | n | IN | The character position in stringIn2 after which stringIn1 is inserted. If n is greater than the length of stringIn2, it is padded with the padding character, pad, until it has enough characters. The default is to insert at the beginning of stringIn2. |
integer | length | IN | The number of characters of stringIn1 to insert. The string is padded with the padding character, pad, if this parameter is greater than the length of stringIn1. The default is the length of stringIn1. |
integer | pad | IN | The padding character, as described for n and length. The default pad character is a blank. |
string | stringOut | OUT | A variable that contains stringIn2 modified by inserting part or all of stringIn1. |
Return Codes
Table 85. DTW_INSERT 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_INSERT("123", "abc", result)
Example 2:
@DTW_INSERT("123", "abc", "5", result)
Example 3:
@DTW_INSERT("123", "abc", "5", "6", result)
Example 4:
@DTW_INSERT("123", "abc", "5", "6", "/", result)
Example 5:
@DTW_rINSERT("123", "abc", "5", "6", "+")