The following are the set of standard string functions supported by Net.Data:
Attention: Net.Data does not support multi-byte character string manipulation on any platforms other than the OS/400.
Purpose
| AIX | HP-UX | OS/2 | OS/390 | OS/400 | SCO | SUN | Win NT |
| X | X | X | X | X | X | X | X |
Assigns the value of an input variable to an output variable. Because $(Vn), where n is a number, is not recognized outside the REPORT block, you can use this function to assign the value to a different variable if you want to reference the value outside the ROW block.
You can also use this function to change a variable in a macro. For example, you can change DATABASE for an HTML block. (See the example in DATABASE.)
Syntax
Parameters
Table 20. DTW_ASSIGN Parameters
| Data Type | Parameter | Use | Description |
|---|---|---|---|
| string | stringOut | OUT | A variable that contains the literal string identical to stringIn. |
| string | stringIn | IN | A variable or literal string. |
Examples
Example 1:
@DTW_ASSIGN(RC, "0")
Example 2:
@DTW_ASSIGN(string1, string2)
Purpose
| AIX | HP-UX | OS/2 | OS/390 | OS/400 | SCO | SUN | Win NT |
| X | X | X | X | X | X | X | X |
Concatenates two strings.
Syntax
Parameters
Table 21. DTW_CONCAT Parameters
| Data Type | Parameter | Use | Description |
|---|---|---|---|
| string | stringIn1 | IN | A variable or literal string. |
| string | stringIn2 | IN | A variable or literal string. |
| string | stringOut | OUT | A variable that contains a string of 'stringIn1 + stringIn2'. |
Examples
Example 1:
@DTW_CONCAT("This", " is a test.", result)
Example 2:
@DTW_CONCAT(string1, "Jose!", result)
Example 3:
@DTW_rCONCAT("This", " is a test.")
Purpose
| AIX | HP-UX | OS/2 | OS/390 | OS/400 | SCO | SUN | Win NT |
| X | X | X | X | X | X | X | X |
Deletes a substring of the specified string from the nth character for length characters.
Syntax
Parameters
Table 22. DTW_DELSTR Parameters
| Data Type | Parameter | Use | Description |
|---|---|---|---|
| string | stringIn | IN | A variable or literal string. |
| integer | n | IN | The position of the character where the substring to delete begins. If n is greater than the length of stringIn, then stringOut is set to the value of stringIn. |
| integer | length | OUT | The length of the substring to delete. The default is to delete all characters to the end of stringIn. |
| string | stringOut | OUT | A variable that contains the modified form of stringIn. |
Examples
Example 1:
@DTW_DELSTR("abcde", "3", "2", result)
Example 2:
@DTW_rDELSTR("abcde", "6", "1")
Purpose
| AIX | HP-UX | OS/2 | OS/390 | OS/400 | SCO | SUN | Win NT |
| X | X | X | X | X | X | X | X |
Inserts a string into another string starting after the nth character.
Syntax
Parameters
Table 23. 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 used 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. |
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", "+")
Purpose
| AIX | HP-UX | OS/2 | OS/390 | OS/400 | SCO | SUN | Win NT |
| X | X | X | X | X | X | X | X |
Returns the position of the last occurrence of a string in another string, starting from the nth character working backwards.
Syntax
Parameters
Table 24. DTW_LASTPOS Parameters
| Data Type | Parameter | Use | Description |
|---|---|---|---|
| string | stringIn1 | IN | A variable or literal string searched for in stringIn2. |
| string | stringIn2 | IN | A variable or literal string. |
| integer | n | IN | The character position in stringIn2 to begin searching for stringIn1. The default is to start searching at the first character. |
| integer | position | OUT | The position of the last occurrence of stringIn1 in stringIn2. If no occurrence is found, 0 is returned. |
Examples
Example 1:
@DTW_LASTPOS(" ", "abc def ghi", result)
Example 2:
@DTW_LASTPOS(" ", "abc def ghi", "10", result)
Example 3:
@DTW_rLASTPOS(" ", "abc def ghi", "7")
Purpose
| AIX | HP-UX | OS/2 | OS/390 | OS/400 | SCO | SUN | Win NT |
| X | X | X | X | X | X | X | X |
Returns the length of a string.
Syntax
Parameters
Table 25. DTW_LENGTH Parameters
| Data Type | Parameter | Use | Description |
|---|---|---|---|
| string | stringIn | IN | A variable or literal string. |
| integer | length | OUT | A symbol containing the length of stringIn. |
Examples
Example 1:
@DTW_LENGTH("abcdefgh", result)
Example 2:
@DTW_rLENGTH("")
Purpose
| AIX | HP-UX | OS/2 | OS/390 | OS/400 | SCO | SUN | Win NT |
| X | X | X | X | X | X | X | X |
Returns a string in all lower case.
Syntax
Parameters
Table 26. DTW_LOWERCASE Parameters
| Data Type | Parameter | Use | Description |
|---|---|---|---|
| string | stringIn | IN | A variable or literal string with characters of any case. |
| string | stringOut | OUT | A variable that contains stringIn with all characters in lower case. |
| string | stringMult | INOUT |
|
Examples
Example 1:
@DTW_LOWERCASE("This", stringOut)
Example 2:
@DTW_rLOWERCASE(string1)
Example 3:
@DTW_mLOWERCASE(string1, string2, string3)
Purpose
| AIX | HP-UX | OS/2 | OS/390 | OS/400 | SCO | SUN | Win NT |
| X | X | X | X | X | X | X | X |
Returns the position of the first occurrence of a string in another string.
Syntax
Parameters
| Data Type | Parameter | Use | Description |
|---|---|---|---|
| string | stringIn1 | IN | A variable or literal string to search for. |
| string | stringIn2 | IN | A variable or literal string to search |
| integer | n | IN | The character position in stringIn2 to begin searching. The default value is to start searching at the first character of stringIn2. |
| integer | nOut | OUT | A variable that contains the position of the first occurrence of stringIn1 in stringIn2. If no occurrence is found, 0 is returned. |
Examples
Example 1:
@DTW_POS("day", "Saturday", result)
Example 2:
@DTW_POS("a", "Saturday", "3", result)
Example 3:
@DTW_rPOS(" ", "abc def ghi", "5")
Purpose
| AIX | HP-UX | OS/2 | OS/390 | OS/400 | SCO | SUN | Win NT |
| X | X | X | X | X | X | X | X |
Reverses the input string.
Syntax
Parameters
Table 28. DTW_REVERSE Parameters
| Data Type | Parameter | Use | Description |
|---|---|---|---|
| string | stringIn | IN | A variable or literal string to reverse. |
| string | stringOut | OUT | A variable that contains the reversed form of stringIn. |
Examples
Example 1:
@DTW_REVERSE("This is it.", result)
Example 2:
@DTW_rREVERSE(string1)
Purpose
| AIX | HP-UX | OS/2 | OS/390 | OS/400 | SCO | SUN | Win NT |
| X | X | X | X | X | X | X | X |
Removes leading blanks, trailing blanks, or both from the input string.
Syntax
Parameters
Table 29. DTW_STRIP Parameters
| Data Type | Parameter | Use | Description |
|---|---|---|---|
| string | stringIn | IN | A variable or literal string. |
| string | option | IN | Specifies which blanks to remove from stringIn. The default is B.
|
| string | stringOut | OUT | A variable that contains stringIn with blanks removed as specified by option. |
Examples
Example 1:
@DTW_STRIP(" day ", result)
Example 2:
@DTW_STRIP(" day ", "T", result)
Example 3:
@DTW_rSTRIP(" a day ", "L")
Purpose
| AIX | HP-UX | OS/2 | OS/390 | OS/400 | SCO | SUN | Win NT |
| X | X | X | X | X | X | X | X |
Returns a substring of the input string, with optional pad characters.
Syntax
Parameters
Table 30. DTW_SUBSTR Parameters
| Data Type | Parameter | Use | Description |
|---|---|---|---|
| string | stringIn | IN | A variable or literal string to be searched. |
| integer | n | IN | The character position where the substring begins. The default is to start at the begining of stringIn |
| integer | length | IN | The number of characters of the substring. The default is the rest of the string. |
| string | pad | IN | The padding character used if n is greater than the length of stringIn or if length goes beyond the end of stringIn. The default is a blank. |
| string | stringOut | OUT | A variable that contains a substring of stringIn. |
Examples
Example 1:
@DTW_SUBSTR("abc", "2", result)
Example 2:
@DTW_SUBSTR("abc", "2", "4", result)
Example 3:
@DTW_SUBSTR("abc", "2", "4", ".", result )
Example 4:
@DTW_rSUBSTR("abc", "2", "6", ".")
Purpose
| AIX | HP-UX | OS/2 | OS/390 | OS/400 | SCO | SUN | Win NT |
| X | X | X | X | X | X | X | X |
Translates characters in the input string using input and output translation tables, tableI and tableO. If there is no tableI, tableO, and pad in the parameter list, the stringIn is translated to upper case. If tableI and tableo are in the list, but there is no pad, each character in the input string is searched for in tableI and translated to the corresponding character in tableO. If pad is in the parameter list, the length of the stringIn and stringOut are the same. The pad character is used if a character in the input string is not in tableI. The translation tables can be of any length. If neither translation table is provided, the input string is translated to upper case.
Syntax
Parameters
Table 31. DTW_TRANSLATE Parameters
| Data Type | Parameter | Use | Description |
|---|---|---|---|
| string | stringIn | IN | A variable or literal string. |
| string | tableO | IN | A variable or literal string used as a translation table. Use null ("") to specify tableI or pad; otherwise this parameter is optional. |
| string | tableI | IN | A variable or literal string searched for in stringIn. Use null ("") to specify pad; otherwise this parameter is optional. |
| string | pad | IN | The padding character to use. The default is a blank. |
| string | stringOut | OUT | A variable that contains a substring of stringIn. |
Examples
Example 1:
@DTW_TRANSLATE("abbc", result)
Example 2:
@DTW_TRANSLATE("abbc", "R", "bc", result)
Example 3:
@DTW_rTRANSLATE("abcdef", "12", "abcd", ".")
Example 4:
@DTW_rTRANSLATE("abbc", "", "", "")
Purpose
| AIX | HP-UX | OS/2 | OS/390 | OS/400 | SCO | SUN | Win NT |
| X | X | X | X | X | X | X | X |
Returns a string in upper case.
Syntax
Parameters
Table 32. DTW_UPPERCASE Parameters
| Data Type | Parameter | Use | Description |
|---|---|---|---|
| string | stringIn | IN | A variable or literal string with characters of any case. |
| string | stringOut | OUT | A variable that contains stringIn with all characters in upper case. |
| string | stringMult | INOUT |
|
Examples
Example 1:
@DTW_UPPERCASE("Test", result)
Example 2:
@DTW_rUPPERCASE(string1)
Example 3:
@DTW_mUPPERCASE(string1, string2, string3)