DTW_POS

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 position of the first occurrence of a string in another string, using a forward search pattern.

Format

@DTW_POS(stringIn1, stringIn2, n, nOut)

@DTW_POS(stringIn1, stringIn2, nOut)

@DTW_rPOS(stringIn1, stringIn2, n)

@DTW_rPOS(stringIn1, stringIn2)

Parameters

Table 92. DTW_POS 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.

Return Codes

Table 93. DTW_POS 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.
1002 An input parameter contained a string value which consisted of the null-terminating character.
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_POS("day", "Saturday", result)

Example 2:

@DTW_POS("a", "Saturday", "3", result)

Example 3:

@DTW_rPOS(" ", "abc def ghi", "5")


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