Logic Help
Moderators: chulett, rschirm, roy
Logic Help
Hello
I am new to datastage development would appriciate any help in logic for belo scenario
My input is seq file with data
oldID newID
1,2
2,3,
4,5
3,6
output expected is
1,6
2,6
4,5
3,6
Please let me know if more information needed
Thanks in advance
I am new to datastage development would appriciate any help in logic for belo scenario
My input is seq file with data
oldID newID
1,2
2,3,
4,5
3,6
output expected is
1,6
2,6
4,5
3,6
Please let me know if more information needed
Thanks in advance
-
- Participant
- Posts: 26
- Joined: Fri Feb 19, 2010 2:08 am
As is often requested for this forum, please describe in words what the business rules are that process your provided (and accurate) example input data in order to produce your provided (and accurate) example output data.
Without that information, the volunteer posters on this forum are forced to guess why the first row comes in as "1,2" and goes out as "1,6", which is not a dependable method to provide accurate answers.
Regards,
Without that information, the volunteer posters on this forum are forced to guess why the first row comes in as "1,2" and goes out as "1,6", which is not a dependable method to provide accurate answers.
Regards,
- james wiles
All generalizations are false, including this one - Mark Twain.
All generalizations are false, including this one - Mark Twain.
Thanks for quick replies
I got your point regarding business rules I apologise for the same
Business rule is,
Id's are updated with newID for eg first we have ID 1 which is updated with newID as 2 ; which (newID 2) upon further updation changed to Id 3 so the Input for eg
oldId newID
1 ---> changed to 2 ------day 1
2---> 3 ------------------day 2
4 --->5 -------------- day2
what I expect is for each ID we need to have recent ID
for above eg expected reult is
oldID newID
1,3
2,3
4,5
I hope this will explain the problem
thanks
I got your point regarding business rules I apologise for the same
Business rule is,
Id's are updated with newID for eg first we have ID 1 which is updated with newID as 2 ; which (newID 2) upon further updation changed to Id 3 so the Input for eg
oldId newID
1 ---> changed to 2 ------day 1
2---> 3 ------------------day 2
4 --->5 -------------- day2
what I expect is for each ID we need to have recent ID
for above eg expected reult is
oldID newID
1,3
2,3
4,5
I hope this will explain the problem
thanks
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 437
- Joined: Fri Oct 15, 2004 6:13 am
- Location: Pune, India
Few years back we had a subset of this requirement and we ended up using the recursive stored procedure for that.
What we did is created a chain of linked records.
Step1: Actual data in a table called as "ChainRels" containing OldID, NewID
Loop:
Insert in the ChainRels outfrom query (select tab1.OldID, tab2.NewID from OrigTable Tab1, Tab2 where Tab1.NewID = Tab2.OldID)
Repeat the loop till the output from the query is zero.
Now you have a table contains each records all IDs. From that do aggregate as Max(NewID) group by OldID.
This can be done in DS as well with looping logic in Sequence. Run the loop in sequence till you have output from a join/lookup.
What we did is created a chain of linked records.
Step1: Actual data in a table called as "ChainRels" containing OldID, NewID
Loop:
Insert in the ChainRels outfrom query (select tab1.OldID, tab2.NewID from OrigTable Tab1, Tab2 where Tab1.NewID = Tab2.OldID)
Repeat the loop till the output from the query is zero.
Now you have a table contains each records all IDs. From that do aggregate as Max(NewID) group by OldID.
This can be done in DS as well with looping logic in Sequence. Run the loop in sequence till you have output from a join/lookup.
Regards,
S. Kirtikumar.
S. Kirtikumar.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Chaining records is easily done with delimited strings in stage variables. I prefer to use server job or BASIC Transformer and work with dynamic arrays in this case, because there is a really handy function called Locate() - and another called Find() - that can be used to search for a value in a dynamic array.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.