View previous topic :: View next topic
|
Author |
Message |
babuprasad_g Currently Banned New User
Joined: 26 May 2005 Posts: 45 Location: gurgaon
|
|
|
|
Hi folks,
My question is:
we have one dateset with duplicate records.like with the name 'babu' we have 5 records.
1.How do we eliminate duplicate records...ok...this is easy
2.i want only one duplicate record means with the name 'babu'i dont want any other records.how is it possible.............. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
It's not clear what you mean by questions 1 and 2. Eliminating duplicates can mean several things.
Please show an example of your input records and what you want for output in case 1 and case 2 to clarify what you mean. |
|
Back to top |
|
|
babuprasad_g Currently Banned New User
Joined: 26 May 2005 Posts: 45 Location: gurgaon
|
|
|
|
Hi,
My problem is:
if we have duplicate records in one file like
babu
babu
babu
babu
babu......like this
i want to copy only duplicate records first.....then i want to copy only one record instead of all duplicate records 'babu'. |
|
Back to top |
|
|
Hritam
New User
Joined: 27 Jun 2005 Posts: 36 Location: India
|
|
|
|
Hi babu,
For the First requirement you can use the Following instruction of DSORT's ICETOOL:
1. To get all Duplicate records:
Code: |
//TOOLIN DD *
SELECT FROM(IN) TO(DUP) ON(P1,L1,F1) ALLDUPS
/*
|
2. To get the First occurance of each set of duplicate records:
Code: |
//TOOLIN DD *
SELECT FROM(IN) TO(DUP) ON(P1,L1,F1) FIRSTDUP
/*
|
If Last occurance then use LASTDUP instead of FIRSTDUP. If you want to use any more cond then you can use the USING statement also e.g
Code: |
//TOOLIN DD *
SELECT FROM(IN) TO(DUP) ON(P1,L1,F1) LASTDUP USING(CTL1)
/*
..
..
//CTL1CNTL DD*
INCLUDE COND=(........)
/*
|
I think this will solve your problem.
Thanks,
Hritam |
|
Back to top |
|
|
babuprasad_g Currently Banned New User
Joined: 26 May 2005 Posts: 45 Location: gurgaon
|
|
|
|
Hi Hritam,
Thank you very much for ur answer. |
|
Back to top |
|
|
babuprasad_g Currently Banned New User
Joined: 26 May 2005 Posts: 45 Location: gurgaon
|
|
|
|
Hi Hritam,
what r p1,l1,f1.if it is position,length,field.
Basically we dont know what r the duplicates we have.that time how is this possible. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Babu,
>I want to copy only duplicate records first.....then I want to copy only one
>record instead of all duplicate records 'babu'.
Your example of 5 records with babu does not really make it clear what you want to do. With that example, copying duplicate records would be the same as copying ALL records, and copying one record would be the same as copying the first record. So I don't think that's what you really want.
If you have both duplicate and non-duplicate records in your input file, for example:
Code: |
babu
babu
babu
babu
babu
cccc
dddd
dddd
eeee
|
then you can write just the duplicate records to OUT1 and the first record of each set of duplicates to OUT2 using a DFSORT job like this:
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file
//OUT1 DD DSN=... output file1
//OUT2 DD DSN=... output file2
//TOOLIN DD *
SELECT FROM(IN) TO(OUT1) ON(1,4,CH) ALLDUPS
SELECT FROM(IN) TO(OUT2) ON(1,4,CH) FIRSTDUP
/*
|
OUT1 would have:
Code: |
babu
babu
babu
babu
babu
dddd
dddd
|
OUT2 would have:
If that's not what you want, then you need to show me a better example of your input
records and what you want for output. |
|
Back to top |
|
|
komal
New User
Joined: 09 May 2005 Posts: 17
|
|
|
|
Hi Frank,
My shop doesn't have ICETOOL so, can we do this using DFSORT or SYNCSORT? |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
komal
1. Do you have DFSORT or SYNCSORT?
2. If not sure, then run a simple sort JOB and check your SYSOUT.
3. Did you try running Frank's solution? Did you recieve any error? If so paste the SPOOL details here. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
My shop doesn't have ICETOOL so, can we do this using DFSORT |
If you have DFSORT, then you do have DFSORT's ICETOOL. ICETOOL has been shipped with DFSORT since 1991! |
|
Back to top |
|
|
|