Holding Previous Key Data Value

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
ririr
Participant
Posts: 84
Joined: Sun Apr 04, 2004 8:59 pm

Holding Previous Key Data Value

Post 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
richdhan
Premium Member
Premium Member
Posts: 364
Joined: Thu Feb 12, 2004 12:24 am

Post 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
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post 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
Post Reply