How to reverse data order?

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
pkll
Participant
Posts: 73
Joined: Thu Oct 25, 2012 9:45 pm

How to reverse data order?

Post by pkll »

Hi,

I have input like:

sno,sname
1,ravi
1,suresh
2,mahesh
3,hari

but I want output like:

sno,sname
1,hari
1,mahesh
2,suresh
3,ravi


my source and target both are text files.I want to reverse second column (sname)

please any one help me?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

This does seem to be a strange requirement, but it can be done.

Add an artificial key such as line number. Use a Copy stage to split the stream into two, with one column in each stream. Sort sname in reverse order and generate a new line number for this stream. Use a Join stage to inner join the two streams.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply