converting numeric data to exponential form in unstructured

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

Post Reply
oracle
Participant
Posts: 43
Joined: Sat Jun 25, 2005 11:52 pm

converting numeric data to exponential form in unstructured

Post by oracle »

Hi,

I have simple job, where i am reading excel sheet using unstructured stage and writing to sequential file. My requirement is get data as it is from excel to output which is CSV file.In the sheet two of columns have numeric data (cell format is general) and Issue was they are converting to exponential form when writing to sequential file

"1.1076079E7","2.3132061E7"

Tried using the source and target datatypes are VARCHAR, NVARCHAR and didn't get expected numeric output.

When i use other than Varchar, NVarchar job is failing . Can you please suggest me on how to get data as it is from input.


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

Post by chulett »

:!: Apologies in advance, Oracle, but I'm going to use you as an example of something Not To Do, something I "fix" over and over. This time decided to point it out and then do the dirty later. Nothing personal! Thanks for coming up and standing on the stage with me for a moment. :wink:

When you create a post here, please feel free to make use of the Additional info field for pertinent information that may help - exact DataStage version comes to mind. Other details / things of that nature. Please don't simply copy your Subject and paste it there, how in the heck is that any kind of "additional information"?

Your Moderator thanks you for your attention in this matter. Helps preserve what little is left of my sanity.
-craig

"You can never have too many knives" -- Logan Nine Fingers
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Now, having said that, on to your actual question.

Sadly, that is default Excel behavior that has driven people nuts from the beginning of time and there are plenty of discussions out there on it for ther Googling. There is no option to disable that, unfortunately. The only "workaround" seems to be not using General for cell format as that gives Excel free rein to do what it wants with the data. Not sure how much this will help the Unstructured stage, if at all, but try changing the format to number or text and see if that solves your problem.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ds_developer
Premium Member
Premium Member
Posts: 224
Joined: Tue Sep 24, 2002 7:32 am
Location: Denver, CO USA

Post by ds_developer »

I can't help with the Unstructured Stage, but I assume you could do a scientific notation conversion into decimal fields in the Sequential File stage. Here is how I've converted scientific notation recently:

Code: Select all

IF NullToValue(nodupes.BOUNDARY_AREA, '') = '' THEN SetNull()  
ELSE IF Num(nodupes.BOUNDARY_AREA) AND Index(nodupes.BOUNDARY_AREA,'e',1) > 0 
THEN DecimalToDecimal(Field(nodupes.BOUNDARY_AREA,'e',1) * 10 ^ Field(nodupes.BOUNDARY_AREA,'e',2))
ELSE IF Num(nodupes.BOUNDARY_AREA) AND Index(nodupes.BOUNDARY_AREA,'E',1) > 0 
THEN DecimalToDecimal(Field(nodupes.BOUNDARY_AREA,'E',1) * (10 ^ Field(nodupes.BOUNDARY_AREA,'E',2)))
ELSE IF Num(nodupes.BOUNDARY_AREA) THEN StringToDecimal(nodupes.BOUNDARY_AREA)
ELSE SetNull()
Hope this helps.
John
Post Reply