Sorting at different record levels

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
smohd1338
Premium Member
Premium Member
Posts: 28
Joined: Fri Aug 03, 2012 1:09 pm

Sorting at different record levels

Post by smohd1338 »

Hi, currently my output is thsi way:
CLIENTID RECORDTYPE EMPNO GroupPolicynumber

ABC101 A1
ABC101 A2
ABC101 A2
ABC101 A3
ABC101 A4
ABC101 A4
ABC101 A5
ABC101 A5
ABC101 B1 7990778998
ABC101 B1 7990789734
ABC101 I1 7990778998 457893275B
ABC101 I1 7990778998 879765992A
ABC101 I1 7990789734 JHJU898977
ABC101 I2 7990778998 457893275B
ABC101 I2 7990778998 879765992A
ABC101 I2 7990789734 JHJU898977
ABC101 I2 7990789734 JHJU898977

and i need it to be sorted this way, i tried many times in many ways, i could not get, any help, wt conconetion should be used while sorting?

ABC101 A1
ABC101 A2
ABC101 A2
ABC101 A3
ABC101 A4
ABC101 A4
ABC101 A5
ABC101 A5
ABC101 B1 7990778998
ABC101 I1 7990778998 457893275B
ABC101 I2 7990778998 457893275B
ABC101 I1 7990778998 879765992A
ABC101 I2 7990778998 879765992A
ABC101 B1 7990789734
ABC101 I1 7990789734 JHJU898977
ABC101 I2 7990789734 JHJU898977
ABC101 I2 7990789734 JHJU898977
sameer
jwiles
Premium Member
Premium Member
Posts: 1274
Joined: Sun Nov 14, 2004 8:50 pm
Contact:

Post by jwiles »

When you examine the desired output sequence, look at the way the column values are grouped together. Which ones change value while others stay the same? The ones that change are further down in the sort order than those that stay the same. You can do this two columns at a time. For example: comparing columns A and B--if B's values stay the same while A's change, then B is sorted before A (i.e. sort order is B, A).

Regards,
- james wiles


All generalizations are false, including this one - Mark Twain.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Looks like you need to sort by CLIENTID then by EMPNO then by GROUPPOLICYNO then by RECORDTYPE and specify Nulls Position as First.
Last edited by ray.wurlod on Thu Dec 20, 2012 9:21 pm, edited 1 time in total.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
jwiles
Premium Member
Premium Member
Posts: 1274
Joined: Sun Nov 14, 2004 8:50 pm
Contact:

Post by jwiles »

I believe GroupPolicyNumber will come before RECORDTYPE
- james wiles


All generalizations are false, including this one - Mark Twain.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Indeed. I meant to type that. I've amended my earlier post.
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