Read Row -1

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
caltog
Premium Member
Premium Member
Posts: 39
Joined: Thu May 22, 2003 7:32 am

Read Row -1

Post by caltog »

Hello,
I want to create a jobs that reads a row from a file in one column and in an other the row-1..

Ex. Data1, Data2
1 Null()
2 1
3 2
... ...

If you have any advice on how to build something like that?
Thanks,
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Sure... but you don't "read row -1". What you can do it hold on to the previous row and then use data from it while processing the current row. End result is the same, just wanted to make that clarification.

Stage variables in a Transformer can do that for you. New versions have more options but this approach is (in my opinion) simpler. Stage variables are evaluated from top to bottom which is key to the technique. I don't have time right now for a Full Wurlod but I'm assuming someone will be along shortly to help. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
caltog
Premium Member
Premium Member
Posts: 39
Joined: Thu May 22, 2003 7:32 am

Post by caltog »

Okey,
Yes holding the last value is fine too.
I've found the following routine 'RowProcGetPreviousValue' but it only works on server job... Is the something identical for parallel jobs?

Regards
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

As you know that the stage variables are executed in sequential manner from top to bottom, you can send the current record to one stage variable and then send the value to another stage variable defined above it. So in this was you can hold any value also you can concatenate the columns to hold entire row.

Also if you want to do it for entire set of records ignoring any keys, you might want to run the transformer in sequential mode.
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
Post Reply