Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.
Moderators: chulett , rschirm , roy
Marley777
Premium Member
Posts: 316 Joined: Tue Jan 27, 2004 3:26 pm
Post
by Marley777 » Wed Jul 06, 2011 1:48 pm
Thanks for reading. How can I convert an input field from varchar 255 to an integer. The fields are latitude and longitude.
below is the value in the longitude field
-84.469345
below is the value in the latitude field
39.074253
Both values come in as varchar 255, but need to convert to integer and keep the '-' sign.
Any help is grealy appreciated.
chulett
Charter Member
Posts: 43085 Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO
Post
by chulett » Wed Jul 06, 2011 2:18 pm
What have you tried? Isn't this just a simple StringToDecimal() conversion?
-craig
"You can never have too many knives" -- Logan Nine Fingers
Marley777
Premium Member
Posts: 316 Joined: Tue Jan 27, 2004 3:26 pm
Post
by Marley777 » Wed Jul 06, 2011 2:38 pm
StringToInteger giver me everything before the decimal position. I'm loading to a db2 field defined as integer...so string to decimal won't work. So not sure how to convert to integer and keep everything to the right of the decimal?
chulett
Charter Member
Posts: 43085 Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO
Post
by chulett » Wed Jul 06, 2011 3:16 pm
Sorry, missed the "integer" part. You... can't. Ask them what "-84.469345" should be as an integer and then you'll know how to handle the conversion. My guess? "-84469345".
-craig
"You can never have too many knives" -- Logan Nine Fingers
Marley777
Premium Member
Posts: 316 Joined: Tue Jan 27, 2004 3:26 pm
Post
by Marley777 » Wed Jul 06, 2011 3:19 pm
how can I keep the numbers to the right of the decimal?
chulett
Charter Member
Posts: 43085 Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO
Post
by chulett » Wed Jul 06, 2011 3:21 pm
As shown above. Keep in mind the fact that, in an integer, there is no "right side of the decimal".
-craig
"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607 Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:
Post
by ray.wurlod » Wed Jul 06, 2011 5:19 pm
Multiply by 100000.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Posts: 43085 Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO
Post
by chulett » Wed Jul 06, 2011 9:22 pm
... the end result of which was shown as "my guess" above.
-craig
"You can never have too many knives" -- Logan Nine Fingers