How to get the last record in a sur key state file

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
Marley777
Premium Member
Premium Member
Posts: 316
Joined: Tue Jan 27, 2004 3:26 pm

How to get the last record in a sur key state file

Post by Marley777 »

Hi, anyone ever tried getting the last record in a surrogate key state file? I know I can use the sur key generator to view the file, but when I create a output link from the sur key gen stage I get all records in the file...only want the last value or record from the file and use it down stream. I know I can also use a transformer with logic of some kind to get the max, but wondering if there is an easier way that doesn't involve the transformer? Thanks for any help you can provide.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

SKey ---> ColGen --> RemDup --> ...

Column Generator generates a constant "key" and Remove Duplicates preserves the last row.

Execute in Sequential mode.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
mansoor_nb
Participant
Posts: 48
Joined: Wed Jun 01, 2005 7:10 am

Post by mansoor_nb »

You can also use Tail stage in the sequential mode by setting the Number Of Rows (Per Partition) = 1. By this the last row is retained for down stream process.

SKey ---> Tail --> ...

Thanks
Post Reply