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

How to count duplicate key records correctly


IBM Mainframe Forums -> SYNCSORT
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2023
Location: USA

PostPosted: Thu Jul 25, 2019 8:03 pm
Reply with quote

Code:
//*================================================
//* COUNT DUPLICATES                               
//*================================================
//COUNTDUP EXEC PGM=SORT                           
//*                                               
//SYSOUT   DD  SYSOUT=*                           
//*                                               
//SORTIN   DD  *                                   
AAAAA                                             
BBBBB                                             
CCCCC                                             
EEEEE                                             
DDDDD                                             
CCCCC                                             
EEEEE                                             
BBBBB                                             
BBBBB                                             
CCCCC                                             
BBBBB                                             
CCCCC                                             
CCCCC                                             
AAAAA                                             
AAAAA                                             
//*                                               
//SORTOUT  DD  SYSOUT=*                           
//*                                               
//SYSIN    DD  *                                   
*                                                 
 SORT FIELDS=(1,30,CH,A)                           
*                                                 
 OUTFIL FNAMES=(SORTOUT),                         
        NODETAIL,REMOVECC,                         
        SECTIONS=(1,30,                           
                  TRAILER3=(1,30,                 
                            C' REPEATED ',         
                            COUNT=(ZD,LENGTH=3),   
                            C' TIMES'))           
*                                                 
 END                                               
//*                                             
//*========================================


Code:
********************************* TOP OF DATA ********
AAAAA                          REPEATED 003 TIMES     
BBBBB                          REPEATED 004 TIMES     
CCCCC                          REPEATED 005 TIMES     
DDDDD                          REPEATED 001 TIMES     
EEEEE                          REPEATED 002 TIMES     
******************************** BOTTOM OF DATA ******


The same approach also works for DFSORT, mysteriously moved to separate partition of the forum.

Mod: *** Syncsort ONLY solutions will be moved to the relevant forum, in this case it did not appear the 'solution' was complete either.***
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 -> SYNCSORT

 


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 To get the count of rows for every 1 ... DB2 3
No new posts Duplicate transid's declared using CEDA CICS 3
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top