IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Want to remove only one duplicate record using DFSORT


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
babuprasad_g
Currently Banned

New User


Joined: 26 May 2005
Posts: 45
Location: gurgaon

PostPosted: Mon Jun 27, 2005 9:20 am
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Jun 28, 2005 2:23 am
Reply with quote

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
View user's profile Send private message
babuprasad_g
Currently Banned

New User


Joined: 26 May 2005
Posts: 45
Location: gurgaon

PostPosted: Tue Jun 28, 2005 11:25 am
Reply with quote

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
View user's profile Send private message
Hritam

New User


Joined: 27 Jun 2005
Posts: 36
Location: India

PostPosted: Tue Jun 28, 2005 12:13 pm
Reply with quote

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
View user's profile Send private message
babuprasad_g
Currently Banned

New User


Joined: 26 May 2005
Posts: 45
Location: gurgaon

PostPosted: Tue Jun 28, 2005 12:46 pm
Reply with quote

Hi Hritam,

Thank you very much for ur answer.
Back to top
View user's profile Send private message
babuprasad_g
Currently Banned

New User


Joined: 26 May 2005
Posts: 45
Location: gurgaon

PostPosted: Tue Jun 28, 2005 12:49 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Tue Jun 28, 2005 10:03 pm
Reply with quote

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:

Code:

babu
dddd


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
View user's profile Send private message
komal

New User


Joined: 09 May 2005
Posts: 17

PostPosted: Mon Aug 06, 2007 5:08 pm
Reply with quote

Hi Frank,
My shop doesn't have ICETOOL so, can we do this using DFSORT or SYNCSORT?
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Mon Aug 06, 2007 5:33 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Aug 06, 2007 8:42 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Duplicate transid's declared using CEDA CICS 3
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
Search our Forums:

Back to Top