HOW CONCAT "0 " IN MONTH TRANSFORMER

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
andregomes
Participant
Posts: 4
Joined: Thu Feb 25, 2016 9:12 am

HOW CONCAT "0 " IN MONTH TRANSFORMER

Post by andregomes »

Good Morning,
I have a date field that shows the month and year , but the format is that way, " 12016 " but I want to show this way " 012016 " as include 0 left on the date ? I use the transformer the clause " Cats ( Oconv ( DataAtual , " DM [ 2 ] " ) , Oconv ( DataAtual , " DY "[4] ) ) " to generate the data .

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

Post by chulett »

Cats? :?

Why not just do it all at once?

Code: Select all

Oconv (DataAtual, "DMY", "[2,4]") 
Now, that's off the top of my dusty head but should get you pretty close. That may leave a space between the two but you can use Convert to remove it.
-craig

"You can never have too many knives" -- Logan Nine Fingers
andregomes
Participant
Posts: 4
Joined: Thu Feb 25, 2016 9:12 am

Post by andregomes »

Thank you before was that way with CATS, had already made ​​the move to Oconv ( DataAtual , " DMY " , " [2.4 ]" ) ---- but not yet solved the problem of the month , I believe it is something in sql server
Andre
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Not sure what this conversation has to do with SQL Server.

So what happens if you use the code I posted, what is the resulting string?
-craig

"You can never have too many knives" -- Logan Nine Fingers
andregomes
Participant
Posts: 4
Joined: Thu Feb 25, 2016 9:12 am

Post by andregomes »

Same result, "12016" i need to " 012016"
Andre
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

We know what you need. What is your target data type? It needs to be a string and I suspect you are putting it into a number which strips the 'not significant' leading zero. If you are using a string then post the actual code you are using, copy/paste from the transformer (don't hand type it).
-craig

"You can never have too many knives" -- Logan Nine Fingers
andregomes
Participant
Posts: 4
Joined: Thu Feb 25, 2016 9:12 am

Post by andregomes »

Sorry, In the field is string database ( 6) in the transformer also like to know that the transformer is with drawing 'not significant ?
Andre
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Code: Select all

Oconv(DateActual, "DMY[2,4]" : @VM : "MCN")
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply