Skip to main content

 
IBM Power Systems software  >  IBM i  > Software  > 

Net.Data for i5/OS

  

Overview News Library Education Support
New DTW PAD Built-in Function

Here is the description of the function (this function is not yet in the Net.Data Reference manual). Available on V4R4 and subsequent releases. Ensure you have the latest Net.Data PTF.

DTW_PAD

Purpose
Pads a string with a specified character.

Format
@DTW_PAD(option, var, length, padValue, result)
@DTW_PAD(option, var, length, result)
@DTW_rPAD(option, var, length, padValue)
@DTW_rPAD(option, var, length)

Parameters
Table 1. DTW_PAD Parameters

Data Type Parameter Use Description
string option IN Specifies which direction to pad the string. Possible values:
L or l
Pads to the left of the input string var.
R or r
Pads to the right of the input string var.
string var IN A variable or literal string that is to be padded.
integer length IN The number of pad characters that will be used to pad the input string var. Value must be zero or greater.
string padValue IN The pad character. Must be 1 byte. If not specified, the default pad character is the space (blank) character.
string result OUT A variable that will contain var that is padded to the left or right with length pad characters.

Return Codes
Table 2. DTW_PAD 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

  1.    @DTW_LENGTH(inputval, len)
       %IF (len != "10")
          @DTW_PAD("R", inputval, @DTW_rSUBTRACT("10", len), inputval)
          @sqlcall(inputval)
       %ENDIF