How to Select distinct records from Files

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

anil kumar
Participant
Posts: 8
Joined: Sat Jun 25, 2005 8:03 am
Location: bangalore

Re: How to Select distinct records from Files

Post by anil kumar »

Hi thanks for ur quick response...
but still i have one doubt that ..in that scenario if u have duplicate records it will work..as u explained in the example what happens to first record itself..the condition will not satisfy..right....for the second record it is ok...

please clarify me ....

thanks
DataStageCnu
Participant
Posts: 37
Joined: Sun Aug 01, 2004 1:18 am

Re: How to Select distinct records from Files

Post by DataStageCnu »

anil kumar wrote:Hi thanks for ur quick response...
but still i have one doubt that ..in that scenario if u have duplicate records it will work..as u explained in the example what happens to first record itself..the condition will not satisfy..right....for the second record it is ok...

please clarify me ....

thanks
You can do it by using Hash stage or.. by loading into any database stage and then select distince.

Is it make sence...Let me know, if you have any questions
Thanks,
Cnu


We work together to workout...
Tasneem
Participant
Posts: 8
Joined: Thu Aug 11, 2005 12:29 am

Post by Tasneem »

If u r sorting the records using the Sort stage,use the cluster key change feature to remove duplicates.
This works on the same logic as the StgVariables. :)
ravij
Premium Member
Premium Member
Posts: 170
Joined: Mon Oct 10, 2005 7:04 am
Location: India

Post by ravij »

Hello Kumar

Where can difine the Sort command?


thanks in advance
RK
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Anywhere you like, but typically in the Input Values field when using ExecSH as a before-job or before-stage subroutine.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
yaminids
Premium Member
Premium Member
Posts: 387
Joined: Mon Oct 18, 2004 1:04 pm

Re: How to Select distinct records from Files

Post by yaminids »

Anil,

When you define the Stage variables assign them an initial value which wont appear in the input data

Yamini
anil kumar
Participant
Posts: 8
Joined: Sat Jun 25, 2005 8:03 am
Location: bangalore

Re: How to Select distinct records from Files

Post by anil kumar »

thank you very much...

it is working fine.
sumeet
Premium Member
Premium Member
Posts: 54
Joined: Tue Aug 30, 2005 11:44 pm

Use Sort Stg or command and then place stage variable

Post by sumeet »

I agree with this logic that Stage variable can be used to remove the duplicate files but stage variable stores the previous field value. so its better to have sort the data and club the duplicate recs together and then use the stage variable concept.
Post Reply