View previous topic :: View next topic
|
Author |
Message |
rswathi_1208
New User
Joined: 14 May 2010 Posts: 11 Location: chennai
|
|
|
|
Hi,
Is there a way to delete duplicate records?
Following is my Sort input..
//SORTIN1 DD *
1234566789
1234384848
2632366334
2834748758
//SORTIN2 DD *
1234566789
2834748758
2948343834
I need my Sort out as
1234384848
2632366334
2834748758
Pls suggest |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
isn't 2834748758 also a duplicate record ?
Gerry |
|
Back to top |
|
|
santoshkumarmanilakkoju
New User
Joined: 24 Nov 2009 Posts: 37 Location: Don't know
|
|
|
|
Can you be a little clear with your requirement:
As I understand you have two files and you want all the unmatched records to write into a third file. |
|
Back to top |
|
|
r arunmoezhi
New User
Joined: 26 Jun 2009 Posts: 32 Location: Chennai
|
|
|
|
Can you be more specific.
Will SORTIN1 file contain duplicates?
Will SORTIN2 file contain duplicates?
After merging both the files and if a duplicate is found, do you want to delete all the instances of the duplicate records or do you want to keep the first duplicate.
Please find below a generic version of sort.
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//SORTIN1 DD *
1234566789
1234384848
2632366334
2834748758
/*
//SORTIN2 DD *
1234566789
2834748758
2948343834
/*
//TEMP DD DSN=&TEMP,DISP=(MOD,PASS)
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(SORTIN1) TO(TEMP)
COPY FROM(SORTIN2) TO(TEMP)
SELECT FROM(TEMP) TO(OUT) ON(1,10,CH) NODUPS
/*
|
The keyword 'NODUPS' can be replaced with any of the following:
FIRST
FIRSTDUP
Check if any of the keywords suits your requirement. Or else post a detailed requirement. |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
no need to copy the files to TEMP
this will give you the same result
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD *
1234566789
1234384848
2632366334
2834748758
/*
// DD *
1234566789
2834748758
2948343834
/*
//OUT DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(1,10,CH) NODUPS
|
Gerry |
|
Back to top |
|
|
r arunmoezhi
New User
Joined: 26 Jun 2009 Posts: 32 Location: Chennai
|
|
|
|
ya you are right gcicchet. We can concatenate the input files in the JCL itself.
But i deliberately kept them as two seperate DD statements since the requestor did not post a clear requirement.
What if he/she wants to handle duplicates in the two files differentely |
|
Back to top |
|
|
rswathi_1208
New User
Joined: 14 May 2010 Posts: 11 Location: chennai
|
|
|
|
Thank You all..I used 'SELECT FROM(IN) TO(OUT) ON(1,10,CH) NODUPS' and it worked out for me... |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Good to hear it is working - thank you for posting your solution
d |
|
Back to top |
|
|
|