Need to implement below logic in datastage 8.1

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

Post Reply
kalpanam
Participant
Posts: 39
Joined: Sat Apr 19, 2008 6:14 am

Need to implement below logic in datastage 8.1

Post by kalpanam »

HI All,

I need to implement below logic in datastage.Please help me out.I have my input data as:

History
Date Store Sku Price
1-Dec-10 A 1 10
1-Dec-10 A 2 12
1-Dec-10 B 1 5
1-Dec-10 B 2 8
1-Dec-10 C 1 15
2-Dec-10 A 1 10
2-Dec-10 A 2 12
2-Dec-10 B 1 5
2-Dec-10 B 2 8
2-Dec-10 C 1 15
3-Dec-10 A 1 7
3-Dec-10 A 2 12
3-Dec-10 B 1 6
3-Dec-10 B 2 8
3-Dec-10 C 1 15
4-Dec-10 A 1 7
4-Dec-10 A 2 12
4-Dec-10 B 1 6
4-Dec-10 B 2 8
4-Dec-10 C 1 15
5-Dec-10 A 1 10
5-Dec-10 A 2 12
5-Dec-10 B 1 5
5-Dec-10 B 2 8
5-Dec-10 C 1 15
and then I need my ouput as below:

Output
Date Store Sku Price
1-Dec-10 A 1 10
3-Dec-10 A 1 7
5-Dec-10 A 1 10
1-Dec-10 A 2 12
1-Dec-10 B 1 5
3-Dec-10 B 1 6
1-Dec-10 B 2 8
1-Dec-10 C 1 15

Could anyone please help me out in achiving this logic.

Thanks & Regards,
Kalpana.
Kalpana Marupudi
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Aggregator stage, group by the first three fields, take Max of the fourth.

(Edit based on Craig's feedback)
Filter based on Mod(day_number,2)
Last edited by ray.wurlod on Wed Mar 02, 2011 3:44 pm, edited 2 times in total.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
jwiles
Premium Member
Premium Member
Posts: 1274
Joined: Sun Nov 14, 2004 8:50 pm
Contact:

Post by jwiles »

Not quite right...there are even-numbered days within the source data which are missing from the output data. Those need to be filtered out...

Kalpana, were you given any rules to apply to this data to get the results shown, or were you given just the data and results? And, are the results you show us complete? There are other entries missing in your example (besides even dates) that would be kept using Ray's logic: 3-Dec-10 B 2 8, for example.

Regards,
- james wiles


All generalizations are false, including this one - Mark Twain.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

:idea:

General rule of thumb: Never simply post an example of your input data followed only by an example of your desired output. By doing so, you are forcing anyone attempting to help to puzzle out the business rule(s) behind how you got from A to B. Help us help you and always include a written explanation of your transformation rules, what exactly it is you are trying to accomplish. That way we don't have to guess.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply