DTW_TRANSLATE

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 string with each character translated to another character or unchanged.

Format

@DTW_TRANSLATE(stringIn, tableO, tableI, default, stringOut)

@DTW_TRANSLATE(stringIn, tableO, tableI, stringOut)

@DTW_TRANSLATE(stringIn, tableO, stringOut)

@DTW_TRANSLATE(stringIn, stringOut)

@DTW_rTRANSLATE(stringIn, tableO, tableI, default)

@DTW_rTRANSLATE(stringIn, tableO, tableI)

@DTW_rTRANSLATE(stringIn, tableO)

@DTW_rTRANSLATE(stringIn)

Parameters

Table 102. 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 default; otherwise this parameter is optional.
string tableI IN A variable or literal string searched for in stringIn. Use null ("") to specify default; otherwise this parameter is optional.
string default IN The default character to use. The default is a blank.
string stringOut OUT A variable that contains the translated result of stringIn.

Return Codes

Table 103. DTW_TRANSLATE 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.

Usage Notes

  1. If tableI, tableO, and the default character are not in the parameter list, the stringIn parameter is translated to uppercase.
  2. If tableI and tableO are in the list, each character in the input string is searched for in tableI and translated to the corresponding character in tableO. If a character in tableI has no corresponding character in tableO, the default character is used instead.

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", "", "", "")


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