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

COUNT the number of duplicates


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

New User


Joined: 11 Mar 2021
Posts: 8
Location: Canada

PostPosted: Mon Mar 15, 2021 7:01 pm
Reply with quote

Hi guys,

I want to count the number of duplicates in a file and return an RC code
If there is duplicates the COUNT return RC8

Examples :

RC8 example
Code:

//PROC001  EXEC PGM=ICETOOL                                   
//*                                                           
//IN       DD *
5
7
5
//*                                                           
//TOOLIN   DD *                                               
 COUNT FROM(IN) NOTEQUAL(0) RC8 USING(CTL1)                 
/*                                                           
//CTL1CNTL DD *                                               
  //* dfsort that return one line or two lines (if its easier) because there is two 5 in the file
/*                                                           
//TOOLMSG  DD SYSOUT=*                                       
//DFSMSG   DD SYSOUT=*                                       


RC0 example
Code:

//PROC001  EXEC PGM=ICETOOL                                   
//*                                                           
//IN       DD *
5
7
9
//*                                                           
//TOOLIN   DD *                                               
 COUNT FROM(IN) NOTEQUAL(0) RC8 USING(CTL1)                 
/*                                                           
//CTL1CNTL DD *                                               
  //* dfsort that return zero lines because there is no duplicates in the file
/*                                                           
//TOOLMSG  DD SYSOUT=*                                       
//DFSMSG   DD SYSOUT=*                                       
Back to top
View user's profile Send private message
UnicornMaster

New User


Joined: 11 Mar 2021
Posts: 8
Location: Canada

PostPosted: Mon Mar 15, 2021 9:41 pm
Reply with quote

I have think about something like that but it doesn't work because there is no OUT file

Code:

//PROC001  EXEC PGM=ICETOOL                                   
//*                                                           
//IN       DD *
5
7
5
//*                                                           
//TOOLIN   DD *                                               
 SELECT FROM(IN) TO(OUT) ON(1,1,CH) ALLDUPS USING(CTL1)
 COUNT FROM(OUT) NOTEQUAL(0) RC8
/*                                                           
//CTL1CNTL DD *                                               
 SORT FIELDS=(1,1,CH,A)
/*                                                           
//TOOLMSG  DD SYSOUT=*                                       
//DFSMSG   DD SYSOUT=* 
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1255
Location: Bamberg, Germany

PostPosted: Mon Mar 15, 2021 9:44 pm
Reply with quote

Try something like this:
Code:
//PROC001  EXEC PGM=ICETOOL                                   
//TMP      DD DISP=(NEW,PASS),SPACE=..
//IN       DD *                                               
5                                                             
7                                                             
5
/*                                                           
//TOOLIN   DD *                                               
 SELECT FROM(IN) TO(TMP) ON(1,80,BI) ALLDUPS                   
 COUNT FROM(TMP) NOTEQUAL(0) RC8                               
/*                                                             
//TOOLMSG  DD SYSOUT=*                                         
//DFSMSG   DD SYSOUT=*
Back to top
View user's profile Send private message
UnicornMaster

New User


Joined: 11 Mar 2021
Posts: 8
Location: Canada

PostPosted: Mon Mar 15, 2021 10:06 pm
Reply with quote

Joerg.Findeisen wrote:
Try something like this:
Code:
//PROC001  EXEC PGM=ICETOOL                                   
//TMP      DD DISP=(NEW,PASS),SPACE=..
//IN       DD *                                               
5                                                             
7                                                             
5
/*                                                           
//TOOLIN   DD *                                               
 SELECT FROM(IN) TO(TMP) ON(1,80,BI) ALLDUPS                   
 COUNT FROM(TMP) NOTEQUAL(0) RC8                               
/*                                                             
//TOOLMSG  DD SYSOUT=*                                         
//DFSMSG   DD SYSOUT=*


IT WORKS ! THANKS A LOT !

However i have used
//TMP DD DISP=(NEW,PASS)
instead of
//TMP DD DISP=(NEW,PASS),SPACE=..
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 To get the count of rows for every 1 ... DB2 3
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top