Conversion-Varchar to Integer

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
suma
Participant
Posts: 32
Joined: Fri Jun 11, 2004 8:18 am

Conversion-Varchar to Integer

Post by suma »

Hi
I have some doubts with Date Functions.
Many of the Built-in Date Transforms like TAG.TO.YEAR etc returns varchar.I want to apply some arithmetic functions on these results.
Is there any way to convert these varchar to integer.

Also What do the functions Num,Int Return?

Thanks & Regards
SumA
vigneshra
Participant
Posts: 86
Joined: Wed Jun 09, 2004 6:07 am
Location: Chennai

Post by vigneshra »

Hi Suma,

You can very well arithmetic functions as a type conversion will be done implicitly. The function Num(STRING) will return success if the string supplied can be converted to a number. This can be used for validating the string. I don't know if there is a function with name 'int' is there. :roll:
Vignesh.

"A conclusion is simply the place where you got tired of thinking."
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Hello SumA,

DataStage will implicitly perform a string-to-integer conversion when you attempt to perform a mathematical operation to a string; in fact this is one of the features that makes DS such a powerful tool. Of course the conversion will have problems if the string doesn't contain a number and you attempt to subtract something from it. In the case of the functions that return a "2005" type year string you can use it as it if were a number.
Post Reply