decimal to varchar

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
DSbox61
Premium Member
Premium Member
Posts: 62
Joined: Mon May 22, 2006 10:18 am

decimal to varchar

Post by DSbox61 »

hi folks,

i have a column with datatype decimal(9,0) from mainframe and i want to convert it to varchar and insert into another database.

Basically, i want to do a decimal to varchar conversion. i tried using DecimalToString but i could not get the syntax correct.

can u pls help me....thnx.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Simply moving it from a decimal to a varchar will 'convert' it for you. If you need something specific, throw a FMT() in there with it.

ps. Is this a Server question? DecimalToString is a PX thing, but you are in the Server forum and marked it as Server, hence the confusion...
-craig

"You can never have too many knives" -- Logan Nine Fingers
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Re: decimal to varchar

Post by DSguru2B »

DSbox61 wrote: i tried using DecimalToString but i could not get the syntax correct.
You are on server platform and maybe thats why the DecimalToString function doesnt work. Its just available in px. Server is lineant in data type conversions and doesnt fuss about it. PX on the other hand needs explicit conversions.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Data source is specified as mainframe, we assume pushed to your DataStage server machine. Server jobs have no internal data types, so within the job the decimal number is simply a string of characters. That is why all you need to do is specify it as VarChar on the output link of a Transformer stage - no function is required to effect the transition.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
DSbox61
Premium Member
Premium Member
Posts: 62
Joined: Mon May 22, 2006 10:18 am

Post by DSbox61 »

Thnx for the help guyz....and craig, i am on server edition...i was just trying decimaltostring function to see if it can help me in any way...

i resolved the issue by converting it to char as part of the sql query, tht i used in db2 stage and then trimmed the trainling dot(.) in transformer stage. i get the trailing dot since data type is decimal (9,0)....For Ex: if i convert 1234 from decimal to char i get it as 1234.

thnx guyz....
Post Reply