Number 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

reddy
Premium Member
Premium Member
Posts: 168
Joined: Tue Dec 07, 2004 12:54 pm

Number conversion

Post by reddy »

Hi Guyz,

I have a requirement as follows:

I have the source data in the following format:

Source

3001.23
200.2
2345
2323
1876.12


I want the data to be converted into the following format:

Target

3001.23
200.20
2345.00
2323.00
1876.12

Could someone help me with this issue. Thanks in advance.
DeepakCorning
Premium Member
Premium Member
Posts: 503
Joined: Wed Jun 29, 2005 8:14 am

Post by DeepakCorning »

Declare the data type in the target as Decimal with a precision 2. As far as whtvr I have seen When you map it up and the insertion takes place it will automtically take care of the format.
Thanks
Deepak Patil

Convince Them Confuse Them .. What's the difference?
reddy
Premium Member
Premium Member
Posts: 168
Joined: Tue Dec 07, 2004 12:54 pm

Post by reddy »

Hey thank you for quick reply but i already have it in place and even then iam not getting it. decimal(15,2)
Mike
Premium Member
Premium Member
Posts: 1021
Joined: Sun Mar 03, 2002 6:01 pm
Location: Tampa, FL

Post by Mike »

For a server job, crack open the manuals to BASIC functions and introduce yourself to the Fmt function.

Mike
reddy
Premium Member
Premium Member
Posts: 168
Joined: Tue Dec 07, 2004 12:54 pm

Post by reddy »

Mike,

I really appreciate your response but as i mentioned i already have decimal point in it and decimal point is also a character and hence it is not allowing me to do so and is giving me warnings. So by using FMT function we can only insert decimals when there are no decimals but my case is different. I have a mixture of all kinds of numbers.

please let me know if you have any other options.
reddy
Premium Member
Premium Member
Posts: 168
Joined: Tue Dec 07, 2004 12:54 pm

Post by reddy »

Guyz,

Any more suggestions please.


Thank you in advance
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Suggest you let us know what your target is. If we're talking sequential file, then in spite of what you wrote the FMT function *is* the answer. For a database or anywhere else where those zeroes are not significant, don't even worry about doing this.
-craig

"You can never have too many knives" -- Logan Nine Fingers
reddy
Premium Member
Premium Member
Posts: 168
Joined: Tue Dec 07, 2004 12:54 pm

Post by reddy »

Thank you,

My target is Oracle database.

Is it possible to append zero's in the transformer?

any suggestion?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Sure, but there's no point for a NUMBER field. They aren't significant and Oracle doesn't need them. If you want to see them when you select the data back from Oracle, use an appropriate TO_CHAR() mask but worrying about that during your load is a complete waste of time.

Or is this going into a VARCHAR2 field? :?
Last edited by chulett on Thu Oct 16, 2008 2:10 pm, edited 1 time in total.
-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 »

In the DataStage BASIC manual you might also investigate the Fix() function.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
reddy
Premium Member
Premium Member
Posts: 168
Joined: Tue Dec 07, 2004 12:54 pm

Post by reddy »

Thank you again but this is a number field and i think it is not use for a number field but if it is varchar is there any solution?

Please let me know.


FIX() is not solving my problem, thanx though for your time and effort.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You don't have a problem. Seriously, what makes you think you do? :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
reddy
Premium Member
Premium Member
Posts: 168
Joined: Tue Dec 07, 2004 12:54 pm

Post by reddy »

I just had a issue with this this morning and i am unable to figure out how to solve it. so i had to approach you huyz for it.

Suggestions welcome
reddy
Premium Member
Premium Member
Posts: 168
Joined: Tue Dec 07, 2004 12:54 pm

Post by reddy »

craig,

can you be more specific of what you mean!!!!
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Again - what issue? Did the data not load or otherwise generate an error? Or does it just not look the way you'd like it to when you select it back from the database? If the latter, that's just an issue with your select, not the load. That's the difference I'm trying to see if you understand.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply