Page 1 of 1

Holding Previous Key Data Value

Posted: Mon Jul 19, 2004 3:22 pm
by ririr
The source data is read out of Oracle DRS Stage. I have a situation where I need to hold the previous row key data value in the source link and compare it with the current row key data value in the source link, If they value in the previous and curent row matches then I need to write the row to a different output stage.

Any help is appreciated!

Thanks

Posted: Tue Jul 20, 2004 12:39 am
by richdhan
Hi,

Pls search the Datastage forum on stage variables. It will give you more information. Basically you have to use a stage variable and change it whenever there is a change in the source value and set up a constraint so that if the current value matches with the stage variable value then output the current record to another stage.

HTH
--Rich

Think about what you are thinking because as a man thinks so does he become
--Joyce Meyer

Posted: Tue Jul 20, 2004 3:10 am
by vmcburney
You use stage variables and keep in mind the order in which stage variables are derived. Use two stage variables, one to hold the value from the last row and one to hold the value from the new row. The order in which the stage variables are set ensures you retain the value from the previous row.

Derivation Stage Variable
NEW_KEY_VAL OLD_KEY_VAL
Input.Key NEW_KEY_VAL

Constraint for alternative output:
OLD_KEY_VAL <> Input.Key