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
To spilt the year to Months
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 437
- Joined: Fri Oct 15, 2004 6:13 am
- Location: Pune, India
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.
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.
S. Kirtikumar.
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.
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
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
I think simple If statement will do
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
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
Sri