dear all,
i have set of records and i want to reverse them.. for example,
01 John IBM
02 George MSN
03 Peter Oracle
required to be
03 Peter Oracle
02 George MSN
01 John IBM
is that possible in DataStage???
thank you all and i will appreciate any reply
Reverse the records in DataStage
Moderators: chulett, rschirm, roy
thank you for the reply.. however,
the source table is not sorted in asc or desc base order. my main problem is the duplicates in the source table and using hash file stage i can remove the duplicates by keeping the last record while i need the first one.. so i thought of reversing the records order by some mechanism to get through this problem..
your post opened my mind to new techniques i might use.. thanks a lot
the source table is not sorted in asc or desc base order. my main problem is the duplicates in the source table and using hash file stage i can remove the duplicates by keeping the last record while i need the first one.. so i thought of reversing the records order by some mechanism to get through this problem..
your post opened my mind to new techniques i might use.. thanks a lot
If you do end up using a hash file to remove the duplicates in your file, you could store the record number (@INROWNUM) along with your data. Then, by accessing the hash file with a UV stage, you could pull them back out in reverse order.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 3593
- Joined: Thu Jan 23, 2003 5:25 pm
- Location: Australia, Melbourne
- Contact:
You could send it through a sort stage sorting in ascending order. With this sorted data you can remove duplicates with an aggregation stage or a hash file or stage variables. See the deduplicing FAQ for details of each.
With a hash file you will find records overwriting each other leaving you with the last record for each combination.
With the aggregation stage you can use the "Last" aggregate function on non group by fields. Make sure you populate the Sort information on your input columns to speed up the performance of the aggregation stage.
Stage variables will probably be the fastest method but also the trickiest to code.
With a hash file you will find records overwriting each other leaving you with the last record for each combination.
With the aggregation stage you can use the "Last" aggregate function on non group by fields. Make sure you populate the Sort information on your input columns to speed up the performance of the aggregation stage.
Stage variables will probably be the fastest method but also the trickiest to code.
Certus Solutions
Blog: Tooling Around in the InfoSphere
Twitter: @vmcburney
LinkedIn:Vincent McBurney LinkedIn
Blog: Tooling Around in the InfoSphere
Twitter: @vmcburney
LinkedIn:Vincent McBurney LinkedIn
-
- Participant
- Posts: 75
- Joined: Tue May 13, 2003 4:14 am
- Location: California
- Contact:
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: