IBM InfoSphere DataStage, Version 11.3.1
CONVERT statement
Syntax
CONVERT expression1 TO expression2 IN variable
Description
Use the CONVERT statement to replace every occurrence of specific characters in a string with other characters. Every time the character to be converted appears in the string, it is replaced by the replacement character.
expression1 specifies a list of characters to be converted. expression2 specifies a list of replacement characters. The first character of expression2 replaces all instances of the first character of expression1, the second character of expression2 replaces all instances of the second character of expression1, and so on.
If expression2 contains more characters than expression1, the extra characters are ignored. If expression1 contains more characters than expression2, the characters with no corresponding expression2 characters are deleted from the variable.
If variable is the null value, null is returned. If either expression1 or expression2 evaluates to the null value, the CONVERT statement fails and the program terminates with a run-time error message.
Example
A="NOW IS THE TIME"
PRINT A
CONVERT 'TI' TO 'XY' IN A
PRINT A
CONVERT 'XY' TO 'T' IN A
PRINT A
This is the program output:
NOW IS THE TIME
NOW YS XHE XYME
NOW S THE TME
Last updated: 2015-03-09
PDF version of this information: