Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts JOINKEYS Paired and Unpaired Sort MFwhiz DFSORT/ICETOOL 4 Fri Sep 29, 2017 1:48 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us