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

Group where data item A is different for dups on item B


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

New User


Joined: 20 Jan 2010
Posts: 5
Location: UK

PostPosted: Tue Jan 26, 2010 11:09 pm
Reply with quote

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

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed Jan 27, 2010 12:02 am
Reply with quote

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

New User


Joined: 20 Jan 2010
Posts: 5
Location: UK

PostPosted: Wed Jan 27, 2010 12:24 am
Reply with quote

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

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed Jan 27, 2010 12:48 am
Reply with quote

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
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 Store the data for fixed length COBOL Programming 1
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
No new posts JCL EXEC PARM data in C Java & MQSeries 2
Search our Forums:

Back to Top