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

How can I compare two records in a file using sort function?


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

New User


Joined: 31 Oct 2012
Posts: 43
Location: INDIA

PostPosted: Mon Nov 05, 2012 12:43 pm
Reply with quote

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

New User


Joined: 16 Aug 2012
Posts: 44
Location: india

PostPosted: Mon Nov 05, 2012 12:47 pm
Reply with quote

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

New User


Joined: 31 Oct 2012
Posts: 43
Location: INDIA

PostPosted: Mon Nov 05, 2012 12:56 pm
Reply with quote

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

New User


Joined: 16 Aug 2012
Posts: 44
Location: india

PostPosted: Mon Nov 05, 2012 1:10 pm
Reply with quote

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
Code:
0900 0103 P

out2
Code:
1000 0101 P
1000 0102 T
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Tue Nov 06, 2012 2:49 am
Reply with quote

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

New User


Joined: 16 Aug 2012
Posts: 44
Location: india

PostPosted: Tue Nov 06, 2012 10:38 am
Reply with quote

thanks Gerry
Back to top
View user's profile Send private message
tamminenisidhartha
Currently Banned

New User


Joined: 31 Oct 2012
Posts: 43
Location: INDIA

PostPosted: Tue Nov 06, 2012 2:47 pm
Reply with quote

Hi all.
I would like to thank you for your valuable suggestions.
My query was successfully solved.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Nov 06, 2012 8:36 pm
Reply with quote

Good to hear it - thank you for letting us know icon_smile.gif

d
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
Search our Forums:

Back to Top