Type conversion function in Datastage

Reading Time: 3 minutes
Char(65)Generates an ASCII character from its numeric code value. You can optionally specify the allow8bits argument to convert 8-bit ASCII values
The following example outputs the ASCII code 65 as the character A.
Seq(“A”)Generates a numeric code value from an ASCII character. You can optionally specify the allow8bits argument to convert 8-bit ASCII values.
The following example outputs the character A as the ASCII code 65. 
DateToString(mylink.mydate, “%dd:%mm:%yyyy”)The following example outputs the date contained in the column mylink.mydate to a string with the format dd:mm:yyyy. If mylink.mydate contained the date 18th August, 2009, then the output string would be “18:08:2009”:
StringToDate(mylink.mystring,”%dd:%mm:%yyyy”)If the column mylink.mystring contains the string ″18:08:1958″, then the following function returns the date 1958–08–18. 
DateToDecimal (mylink.basedate, “%dd%mm%yyyy”)If the column mylink.basedate contains the date 2012-08-18, then the following function stores the date as the decimal number 18082012:
DecimalToDate (mylink.basedate, “%dd%mm%yyyy”)If the column mylink.mydecdata contains the value 18082012, then the following function returns the date 2012-08-18:
DecimalToDecimal(mylink.mydec,”ceil”) If the column mylink.mydec contains the decimal number 2.5345, the following function returns the decimal number 00000002.54
DecimalToString(mylink.mydec,”suppress_zero”)If the column mylink.mydec contains the decimal number 00000004.00, the following function returns the string “0000000000000000000000000004.0000000000”.
DecimalToString(mylink.mydec,”fix_zero”)If the column mylink.mydec contains the decimal number 00012344.00, the following function returns the string “12344”.
StringToDecimal(mylink.mystring,”ceil”)If the column mylink.mystring contains the string “19982.2276”, and the target is defined as having a precision of 7 and a scale of 2, then the following function returns the decimal 19983.23.
DecimalToTimestamp(mylink.mytimestampdec, “%hh%nn%ss%yy%mm%dd”)If the column mylink.mytimestampdec contains the decimal value 200658580818, then the following function returns the timestamp 1958–08–18 20:06:58:
IsValid(“int8”,mylink.mystring)If the column mylink.mystring contains the string “1”, then the following function returns the value 1
If the column mylink.mystring contains the string “380096.06”, then the following function returns the value 0.
IsValidDate(mylink.mydate) If the column mylink.mydate contains the date 2011-09-13, then the following function returns the value 1.
If the column mylink.mydate contains the string “380096.06”, then the following function returns the value 0, because the converted string is not a valid date.
IsValidDecimal(mylink.mynum) If the column mylink.mynum contains the value 310007.65, then the following function returns the value 1.
If the column mylink.mynum contains the string “wake-robin”, then the following function returns the value 0, because the converted string is not a valid decimal.
IsValidTime(mylink.mytime)If the column mylink.mytime contains the time 23:09:22, then the following function returns the value 1:
If the column mylink.mydate contains the string “IbnKayeed”, then the following function returns the value 0, because the converted string is not a valid time.
IsValidTimestamp(mylink.mytimestamp)If the column mylink.mytimestamp contains the time 2011-09-13 23:09:22, then the following function returns the value 1:
If the column mylink.mytimestamp contains the string “one of two”, then the following function returns the value 0, because the converted string is not a valid timestamp.
StringToTime(mylink.mystring,”%(h,s):$(n,s):$(s,s)”)