DSXchange: DataStage and IBM Websphere Data Integration Forum
View next topic
View previous topic
Add To Favorites
Author Message
jeisma
Participant



Joined: 20 Mar 2017
Posts: 18

Points: 167

Post Posted: Fri Jan 12, 2018 1:16 pm Reply with quote    Back to top    

DataStage® Release: 11x
Job Type: Parallel
OS: Windows
Hi,

This simple programming task made me spent couple of days trying to implement in ds, to no avail Embarassed

If I have this data:

Code:
col1   col2
id1         5
id2         0
id3         0
id4         0
id5         0


I'd lke to output to become just one row, where col2 is the last non zero value read.

Code:
col1     col2
row          5


My approach is compare current_value versus previous_value, so if current_value is zero, it take previous_value. Given the data above, my output becomes:

Code:
col1   col2
id1         5
id2         0
id3         5
id4         0
id5         5


To think that I still need to hurdle the joining the data into one row. Sad

Any ideas how to solve the above problems?


TIA!
thompsonp



Group memberships:
Premium Members

Joined: 01 Mar 2005
Posts: 200

Points: 1868

Post Posted: Wed Jan 17, 2018 9:36 am Reply with quote    Back to top    

What are you hoping to see in col1 on the output?

If it's just the col1 value from the row that had the last non zero value in col2 then it's straightforward.

Filter out all the rows where col2 is zero, then take the last row (tail).
Rate this response:  
Not yet rated
Display posts from previous:       

Add To Favorites
View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Powered by phpBB © 2001, 2002 phpBB Group
Theme & Graphics by Daz :: Portal by Smartor
All times are GMT - 6 Hours