Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: How can I compare two records in a file using sort function?
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    Post subject:
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    Post subject:
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    Post subject:
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: 1703
Location: Australia

PostPosted: Tue Nov 06, 2012 2:49 am    Post subject:
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    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Tue Nov 06, 2012 8:36 pm    Post subject: Reply to: How can I compare two records in a file using sort
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 1 Fri Dec 09, 2016 4:40 am
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us