View previous topic :: View next topic
|
Author |
Message |
NeilDev
New User
Joined: 20 Jan 2010 Posts: 5 Location: UK
|
|
|
|
Hi,
If I have the follwing records in a file:
Field 1 Field 2
AAAAA 12345
AAAAB 12345
AAABB 12345
FFFFFF 55555
BBBBB 99999
BBBBB 99999
I want to output the duplicates on Field 2, but only where there are differences in Field 1. So, given the above example, my output will be:
AAAAA 12345
AAAAB 12345
AAABB 12345.
Notice even though feild 2 has dupliates of 99999, it is not output because in all records field 1 are identical. |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
What if there is repetition of AAAAA with second field as 12345
Can you please tell what should be output in below case?
Code: |
AAAAA 12345
AAAAA 12345
AAAAA 12345
AAAAB 12345
AAABB 12345
FFFFFF 55555
BBBBB 99999
BBBBB 99999
|
What sort product do you use? |
|
Back to top |
|
|
NeilDev
New User
Joined: 20 Jan 2010 Posts: 5 Location: UK
|
|
|
|
Hi Sambhaji,
In your example the output would be this:
AAAAA 12345
AAAAB 12345
AAABB 12345
Altough, I wouldn't mind too much if the code is easier and all the AAAAA records are output.
I use Z/OS DFSORT V1R10 |
|
Back to top |
|
|
Escapa
Senior Member
Joined: 16 Feb 2007 Posts: 1399 Location: IL, USA
|
|
|
|
Hi NeilDev,
Below ICETOOL step will give you desired result.
Code: |
//S1 EXEC PGM=ICETOOL
//SYSOUT DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//TOOLMSG DD SYSOUT=*
//IN DD *
AAAAA 12345
AAAAA 12345
AAAAA 12345
AAAAB 12345
AAABB 12345
FFFFF 55555
BBBBB 99999
BBBBB 99999
/*
//OUT DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(IN) TO(OUT) ON(7,5,CH) HIGHER(1) USING(CTL1)
/*
//CTL1CNTL DD *
SORT FIELDS=(7,5,CH,A,1,5,CH,A)
SUM FIELDS=NONE
/*
|
Output will be
Code: |
AAAAA 12345
AAAAB 12345
AAABB 12345
|
|
|
Back to top |
|
|
|