IBM Books

Reference

DTW_SUBSTR


AIX HP-UX Linux OS/2 OS/390 OS/400 SCO SUN Win NT
X X X X X X X X X

Purpose

Returns a substring of a string, with optional pad characters.

Format

@DTW_SUBSTR(stringIn, n, length, pad, stringOut)

@DTW_SUBSTR(stringIn, n, length, stringOut)

@DTW_SUBSTR(stringIn, n, stringOut)

@DTW_rSUBSTR(stringIn, n, length, pad)

@DTW_rSUBSTR(stringIn, n, length)

@DTW_rSUBSTR(stringIn, n)

Parameters

Table 98. DTW_SUBSTR Parameters

Data Type Parameter Use Description
string stringIn IN A variable or literal string to be searched.
integer n IN The first character position of the substring. The default is to start at the beginning 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 is longer than stringIn. The default is a blank.
string stringOut OUT A variable that contains a substring of stringIn.

Return Codes

Table 99. DTW_SUBSTR 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 The number of parameters passed on a function call either exceeded the maximum number allowed, or was less than the minimum number required by the function.
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_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", ".")


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]