Page 1 of 1

Converting Amount in integer to amount in words

Posted: Mon Nov 19, 2012 12:52 am
by abhilashnair
I have a requirement to Convert Amount in integer to amount in words
For eg: 1500 in source should get converted to Thousand Five Hundred in target

Any suggestions?

Posted: Mon Nov 19, 2012 1:22 am
by vamsi.4a6
What about the source and target details?Is it a flat file or database etc?

Posted: Mon Nov 19, 2012 1:48 am
by jerome_rajan
An external routine might be able to ease your job. Not too sure about a tailor-made functionality in DataStage that wills erve your purpose

Posted: Mon Nov 19, 2012 2:54 am
by abhilashnair
The source as well as target will be database

Posted: Mon Nov 19, 2012 3:00 am
by jerome_rajan
See if This helps. You can probably get a custom SQL at your source. This is under the assumption that your database is Oracle. Not too ure whether the SQLs mentioned will work with other DBs

Posted: Mon Nov 19, 2012 3:07 am
by vamsi.4a6
If is oracle means then u can use below query

select to_char(to_date(1500 ,'j'),'jsp') from dual;

If it is some other Database means use equivalent functions for to_date,to_char

Posted: Mon Nov 19, 2012 3:13 am
by abhilashnair
So this means I have to rely on database functions and not on DataStage?

Posted: Mon Nov 19, 2012 3:16 am
by vamsi.4a6
I think we do not have any Direct function in Datastage,otherwise you have to write external parallel routine suggested by jerome_rajan

Posted: Mon Nov 19, 2012 4:57 am
by ray.wurlod
There's nothing built-in, but you can certainly create a routine. I recall creating a server routine to do just this thing many years back. Resolve certain questions first, such as whether commas and "and" are needed. For example "one thousand seven hundred twenty eight" or "one thousand, seven hundred and twenty eight". This routine is a useful example of recursion; you only need to write the function to handle up to a million; it can call itself to handle larger numbers.