Logic Help

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
bicap
Premium Member
Premium Member
Posts: 95
Joined: Mon May 03, 2010 10:22 pm
Location: India
Contact:

Logic Help

Post by bicap »

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
kamtammystuff
Participant
Posts: 26
Joined: Fri Feb 19, 2010 2:08 am

Post by kamtammystuff »

Try using routines.
_____________________________________
-Kish
jwiles
Premium Member
Premium Member
Posts: 1274
Joined: Sun Nov 14, 2004 8:50 pm
Contact:

Post by jwiles »

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,
- james wiles


All generalizations are false, including this one - Mark Twain.
bicap
Premium Member
Premium Member
Posts: 95
Joined: Mon May 03, 2010 10:22 pm
Location: India
Contact:

Post by bicap »

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
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

So you are seeking the complete list of transitions for any input value, through to the endpoint of that list. Does that sound correct?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
bicap
Premium Member
Premium Member
Posts: 95
Joined: Mon May 03, 2010 10:22 pm
Location: India
Contact:

Post by bicap »

ray.wurlod wrote:So you are seeking the complete list of transitions for any input value, through to the endpoint of that list. Does that sound correct?
yes thats the requirement!
Kirtikumar
Participant
Posts: 437
Joined: Fri Oct 15, 2004 6:13 am
Location: Pune, India

Post by Kirtikumar »

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.
Regards,
S. Kirtikumar.
bicap
Premium Member
Premium Member
Posts: 95
Joined: Mon May 03, 2010 10:22 pm
Location: India
Contact:

Post by bicap »

Thanks Kirtikumar will try and let you know
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

jwiles wrote:As is often requested for this forum...
Thank you James... saved me some typing. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
pandeesh
Premium Member
Premium Member
Posts: 1399
Joined: Sun Oct 24, 2010 5:15 am
Location: CHENNAI, TAMIL NADU

Post by pandeesh »

One of the complex requirement!! :D
pandeeswaran
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

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.
bicap
Premium Member
Premium Member
Posts: 95
Joined: Mon May 03, 2010 10:22 pm
Location: India
Contact:

Post by bicap »

Thanks a lot everyone for replies we resolved it through looping logic in sequence as mention above !!
Post Reply