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
dr.murthy
Participant
Posts: 224 Joined: Sun Dec 07, 2008 8:47 am
Location: delhi
Post
by dr.murthy » Tue Jan 25, 2011 4:16 am
HI ,
I have a funny requirement like , i have a source filed it contains distinct integer values 1 to 12 , my requirement is if its
1 - janauary
2 - febrauary
3 - march ....
Is there any way other than writing a Stage variables .
D.N .MURTHY
nayanpatra
Participant
Posts: 41 Joined: Sat Jun 06, 2009 11:13 pm
Location: Kolkata
Post
by nayanpatra » Tue Jan 25, 2011 5:40 am
You can create a file having all the months(month number, month name) and lookup into it with the month number to fetch the corresponding month name.
Nayan
dr.murthy
Participant
Posts: 224 Joined: Sun Dec 07, 2008 8:47 am
Location: delhi
Post
by dr.murthy » Tue Jan 25, 2011 5:56 am
Thanks for responding ....
Is there any data stage built in function to handle this ???
D.N .MURTHY
nayanpatra
Participant
Posts: 41 Joined: Sat Jun 06, 2009 11:13 pm
Location: Kolkata
Post
by nayanpatra » Tue Jan 25, 2011 6:29 am
I am not aware of any... Are you facing any problem in implementing the lookup file???
Nayan
sajidkp
Participant
Posts: 114 Joined: Thu Apr 30, 2009 12:17 am
Location: New Delhi
Post
by sajidkp » Tue Jan 25, 2011 6:31 am
HI,
More easily, You can write an if else statement is tranformer to get this.
Example:
If value=1 then 'January' else
if value=2 then 'February else
if .................
--------------
-----------------
else 'December'
Regards,
Sajid KP
dr.murthy
Participant
Posts: 224 Joined: Sun Dec 07, 2008 8:47 am
Location: delhi
Post
by dr.murthy » Tue Jan 25, 2011 7:30 am
No , Am not facing any problem but requirement saying Don't use if then else and lookup file or data stage routine ...
D.N .MURTHY
chulett
Charter Member
Posts: 43085 Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO
Post
by chulett » Tue Jan 25, 2011 7:36 am
Construct an otherwise static date from your month number, then StringToDate() followed by DateToString() using just %mmmm for the format mask.
-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 » Tue Jan 25, 2011 2:45 pm
Use a Modify stage and lookup_string_from_int16() function.
or
Use a Lookup stage sourced from a file containing the mappings (or even from an External Source stage containing 12 echo commands).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.