View previous topic :: View next topic
|
Author |
Message |
tamminenisidhartha Currently Banned New User
Joined: 31 Oct 2012 Posts: 43 Location: INDIA
|
|
|
|
Hi all,
I would like to know how to compare two records in the same file.
Suppose if I have a field "emp sal" from column 1 to column 4, I would like to compare the fields of two records in the same file.
Code: |
EMPSAL EMP ID EMP TYPE
1000 0101 P
1000 0102 T
0900 0103 P |
Note : It's comparing the same field in two different records in the same file.
Thank you.
Code'd |
|
Back to top |
|
|
ezio vin
New User
Joined: 16 Aug 2012 Posts: 44 Location: india
|
|
|
|
Compare in the sense what you are trying to do exactly what you need in your output
Do you need to find duplicate records ?? or
Do you need to compare and sum the records ?? |
|
Back to top |
|
|
tamminenisidhartha Currently Banned New User
Joined: 31 Oct 2012 Posts: 43 Location: INDIA
|
|
|
|
Not the duplicate records.
I need to compare the same field in two records in the same file and if they are same, omit those records in the output file.
I am using DFSORT function.
Thank you. |
|
Back to top |
|
|
ezio vin
New User
Joined: 16 Aug 2012 Posts: 44 Location: india
|
|
|
|
try option NODUPS
Code: |
//SORT1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//INDD DD *
1000 0101 P
1000 0102 T
0900 0103 P
//OUT1 DD SYSOUT=*
//OUT2 DD SYSOUT=*
//TOOLIN DD *
SELECT FROM(INDD) TO(OUT1) ON(1,4,CH) NODUPS
SELECT FROM(INDD) TO(OUT2) ON(1,4,CH) ALLDUPS
//SYSOUT DD SYSOUT=* |
output
out1
out2
Code: |
1000 0101 P
1000 0102 T |
|
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
you don't need 2 passes of the file to get your results
Code: |
SELECT FROM(INDD) TO(OUT1) ON(1,4,CH) NODUPS DISCARD(OUT2)
|
Gerry |
|
Back to top |
|
|
ezio vin
New User
Joined: 16 Aug 2012 Posts: 44 Location: india
|
|
|
|
thanks Gerry |
|
Back to top |
|
|
tamminenisidhartha Currently Banned New User
Joined: 31 Oct 2012 Posts: 43 Location: INDIA
|
|
|
|
Hi all.
I would like to thank you for your valuable suggestions.
My query was successfully solved. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Good to hear it - thank you for letting us know
d |
|
Back to top |
|
|
|