To spilt the year to Months

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
ysrini9
Participant
Posts: 108
Joined: Tue Jul 12, 2005 2:51 am

To spilt the year to Months

Post by ysrini9 »

Hi All,

Could any body help me how to takecare To spilt the year to Months in Datastage
--------------------------------------------------
Year Rate
---------------------------------------------------
Input : 012007 2

052007 3

012008 5

Output shoudbe:

Output: 012007 2
022007 2
032007 2
042007 2
052007 3
062007 3
072007 3
082007 3
092007 3
102007 3
112007 3
122007 3
012008 5
022008 5

please suggest me the way to achieve..Please provide me either rotinue or stored procedure or any possible way to handle in DataStage itself.

Thanks in Advance
srini
Kirtikumar
Participant
Posts: 437
Joined: Fri Oct 15, 2004 6:13 am
Location: Pune, India

Post by Kirtikumar »

If I understand correctly what you want to do is - generate the missing months in the coming data with the no. that was assoicate with prev month in the input data.

I am not sure if u can do it in a job as there is no utility to generate rows in DS. But yes, you can do it in basic routines and write this to a file and then read that file wherever needed.

In routine, you would have to generate the months between the two incoming values and write to seq file.
Regards,
S. Kirtikumar.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Of course you can 'generate rows', all that needs is multiple output links from a transformer. That or you simply source from a transformer with the appropriate constraint.

Your requirement isn't exactly clearly stated. However, it seems like Kirtikumar might have it right. If I was doing this, I'd probably put the existing data up in a hashed file, source from a transformer generating the sequence of month/year values and pick up the rate changes from the hashed file. One problem would be when to stop, that isn't clear from your description.
-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 »

Try writing out a clear specification. By doing so you may even solve it yourself! If you do, please post your solution, so as to aid future searchers.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
sribuz
Premium Member
Premium Member
Posts: 19
Joined: Mon Jun 04, 2007 7:26 pm
Location: US

I think simple If statement will do

Post by sribuz »

compare the second character in year
012007 take 1 assign as a
052007 take 5 assign as b

if a<=b
then incerase a by 1
and write year as 0a2007
(this gives your result as 012007,022007,032007,042007)
and rate = prev rate (=2 in first case)
else
rate=newrate (= 5 rate of 052007)
end
Thanks & Regards,
Sri
Post Reply