Hi all,
We are using a BASIC Routine to execute a SQL script and retrieve the input and pass into the next job. Now, the problem is the retrieve input is a STRING datatype but I need it to be a NUMBER datatype instead. Is there anyway to convert the input from STRING to NUMBER in the Basic Routine?
I have tried to Ans = Num(Input) but it assigns 0 to it.
Help!!
BASIC Routine to Convert datatype
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 50
- Joined: Wed Jul 14, 2004 7:56 am
The Num() function checks to see if something is numeric or not... interesting that the answer it returns for you is 0, aka false.
In BASIC, doing math on a string does an implicit conversion so the typical trick is to multiply the field by 1.
Not sure how well this all plays out in a Parallel job.
In BASIC, doing math on a string does an implicit conversion so the typical trick is to multiply the field by 1.
Not sure how well this all plays out in a Parallel job.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Hi,
I don't think you can effect the type of the returned Ans variable like that,
However you can try declaring it in your routine as integer and try to see if it helps (this is a long shot).
Other then that the only thing you can probably do is use modify or transformer stage to convert that string to a number or the other way around (convert the number you have to a string to match the returned data typr from your basic routine.
IHTH,
I don't think you can effect the type of the returned Ans variable like that,
However you can try declaring it in your routine as integer and try to see if it helps (this is a long shot).
Other then that the only thing you can probably do is use modify or transformer stage to convert that string to a number or the other way around (convert the number you have to a string to match the returned data typr from your basic routine.
IHTH,
Roy R.
Time is money but when you don't have money time is all you can afford.
Search before posting:)
Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Time is money but when you don't have money time is all you can afford.
Search before posting:)
Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: