Row by row execution
Moderators: chulett, rschirm, roy
Row by row execution
Hi,
I have a sequential file that has duplicate values on three key fields.I need to update it to a db2 stage.I have to keep non null values of the previous record of the sequential file if the other record has null values in the same fields.
I tried to use oracle stage to use sparse lookup but I still loose the previous nonnull values.
Do u know any ways to do this?
Thanks...
I have a sequential file that has duplicate values on three key fields.I need to update it to a db2 stage.I have to keep non null values of the previous record of the sequential file if the other record has null values in the same fields.
I tried to use oracle stage to use sparse lookup but I still loose the previous nonnull values.
Do u know any ways to do this?
Thanks...
You can use Transformer Stage variable to check if previous value of the rows were not Null and the current row values were Null, then you can replace the current row value to previous row value, if the key fields are same.
You can have additional field to flag the row. You need to filter out the rows based on the flag.
You can have additional field to flag the row. You need to filter out the rows based on the flag.
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Code: Select all
vKey1 = Keycolumn1
vKey2 = Keycolumn2
vKey3 = Keycolumn3
vKeyCheck => If vKey1 = vPrevKey1 and vKey2 = vPrevKey2 and vKey3 = vPrevKey3 Then 1 Else 0
vPrevKey1 = vKey1
vPrevKey2 = vKey2
vPrevKey3 = vKey3
vCol1 => If vKeyCheck = 1 And IsNull(vCol1) Then vPrevCol1 Else vCol1
vPrevCol1 = vCol1
...
...
...
Similarly for other columns
Impossible doesn't mean 'it is not possible' actually means... 'NOBODY HAS DONE IT SO FAR'
Its the order of execution. The stage variables are executed in the order they are defined so the last variable will have the previous rows value by the time the first stage variable is being executed for the current row.dsisbank wrote:I didn't understand how I get the previous values in transformer...
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
I guess in a parallel job or in a server job you can use an aggregator stage setting 3 key columns and using max() on all other fields to get the job done.
And please let me know if it's a parrallel job so I can move it to the proper forum
IHTH (I Hope This Helps),
And please let me know if it's a parrallel job so I can move it to the proper forum
IHTH (I Hope This Helps),
Roy R.
Time is money but when you don't have money time is all you can afford.
Search before posting:)
Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Time is money but when you don't have money time is all you can afford.
Search before posting:)
Join the DataStagers team effort at:
http://www.worldcommunitygrid.org