Scientific Notation conversion

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
Juls
Participant
Posts: 51
Joined: Tue Sep 14, 2004 9:17 am

Scientific Notation conversion

Post by Juls »

Hi,
I am loading a csv file to a SQL table and ran into a problem where one of the records has a column that has a decimal value but in scientific notation: 1.7588676455E7
The datatype of the column is decimal(18,2) both in DS and SQl table.
How can I convert this number to a regular decimal that it would go through without error and load to my table?
No, I can't do anything about the file.

Thanks,
Juls
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Did you try searching? I got 11 hits for "scientific notation", perhaps one of those would be helpful. Either that or "exponent" should turn something up.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Juls
Participant
Posts: 51
Joined: Tue Sep 14, 2004 9:17 am

Post by Juls »

I did both searched but it didn't give me what I need. I did however figure it out on my own.
Thanks.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

DataStage can handle valid scientific notation numbers provided that the exponent is not more than 38.
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
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

If you've figured out something that's not here in the forums, can you please do a couple of things? First would be to mark the thread as Resolved (button at the top of the screen) and secondly post back and let us know what your solution was?

It will be of service to any future searchers with the same problem.

Thanks.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Juls
Participant
Posts: 51
Joined: Tue Sep 14, 2004 9:17 am

Post by Juls »

I used the code below in my transform to figure out what the correct value should be and make it precision = 2:


If Num(myField) And Index(myField, "E", 1) = 0 Then OCONV(myField, "MD2P") Else OCONV(FIELD(myField,"E",1)*(10 ^ (FIELD(myField,"E",2)+2)),"MR2")

Hope this helps someone else.
Post Reply