The RIGHT function examines a source data string and returns the rightmost portion of the data string as specified by a length parameter.
Category
String
Syntax
RIGHT(data_string, length[,pad character])
Parameter | Description |
---|---|
data_string | The data string in character format. This data string can be a field from a source datastore, a variable, a constant or the result of another Function. |
length | This parameter specifies a numeric value that specifies the number of characters (bytes) to be returned from the source data string. |
pad character | This is an optional parameter that specifies a character value that will be used for padding to the left of the string. |
Example
Examine a source data string INPUT_STRING and map the rightmost 4 characters to the target field OUTPUT_STRING. Assume that the data string INPUT_STRING contains the value MUSTANG.
OUTPUT_STRING = RIGHT (INPUT_STRING, 4)
Returns the value 'TANG' and maps the result to the target field.
Examine a source data string and map the rightmost 2 characters to the target field OUTPUT_STRING padding on the left with zeros.
OUTPUT_STRING = RIGHT ('ABCDEFGHIJK', 2, '0')
Returns the value 000000000JK and maps the result to the target field.