Count duplicates



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

Count duplicates

Postby JorenWillems » Tue Sep 04, 2012 3:23 pm

Hi

I want to count the duplicates and put them in an output file.

Input file = VB, RECL=30713
Pos 97,9
LASNF008A   
LISNN007C   
LISNN007C   
LISNN014C   
LISNN014C   
LLSNF069B   
LLSNF069B   
LIPNF009B   
LIPNF009B 
LIPNF009B 
LASNF021A   
LASNF021A   


Wanted output FB:

LISNN007C     2
LISNN014C     2
LLSNF069B     2
LIPNF009B     3   
LASNF021A     2


I tried this but it doens't work. Help me please.

SORT FIELDS=(97,9,CH,A)                       
OUTFIL REMOVECC,NODETAIL,                     
       BUILD=(104X),                           
       OUTREC=(97,104),                       
       SECTIONS(97,9,                         
          TRAILER3=(97,9,COUNT=(EDIT(TTTTT))))
JorenWillems
 
Posts: 9
Joined: Thu Feb 24, 2011 3:13 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Count duplicates

Postby BillyBoyo » Tue Sep 04, 2012 3:52 pm

Can you show in which particular way it doesn't work?

I assume it is the keys which are duplicat?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Count duplicates

Postby JorenWillems » Tue Sep 04, 2012 3:55 pm

I have following abend when executing the jcl:

ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R12 - 11:53 O
               SORT FIELDS=(97,9,CH,A)                                 
               OUTFIL REMOVECC,NODETAIL,                               
                      BUILD=(104X),                                     
                      OUTREC=(97,104),                                 
                      $                                                 
ICE214A 0 DUPLICATE, CONFLICTING, OR MISSING OUTFIL STATEMENT OPERANDS 
                      SECTIONS(97,9,                                   
                      $                                                 
ICE005A 0 BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY   
                         TRAILER3=(97,9,COUNT=(EDIT(TTTTT))))           
                         $                                             
ICE005A 0 BLANK NEEDED IN COLUMN 1 OR OPERATION NOT DEFINED CORRECTLY
JorenWillems
 
Posts: 9
Joined: Thu Feb 24, 2011 3:13 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Count duplicates

Postby BillyBoyo » Tue Sep 04, 2012 4:28 pm

What are you trying to do with BUILD and OUTREC?

You have huge records. I don't know how many, but if there is only a small sub-set of data you need, you should cut down the record to that data as soon as you can.

  INREC BUILD=(97,9,C'0000001')
  SORT FIELDS=(1,9,CH,A)
  SUM FIELDS=(10,7,ZD)


By adding a constant of value 1, and summing on that field, you get the keys and counts on the output.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: Count duplicates

Postby skolusu » Tue Sep 04, 2012 10:17 pm

JorenWillems,

Here is a DFSORT JCL which will give you the desired results. The output will be a 80 byte FB file. I also assumed that your input key is at position 97 including the RDW.

//STEP0100 EXEC PGM=SORT                     
//SYSOUT   DD SYSOUT=*                       
//SORTIN   DD DISP=SHR,DSN=Your input VB file
//SORTOUT  DD SYSOUT=*                       
//SYSIN    DD *                               
  INREC BUILD=(1,4,97,9)                     
  SORT FIELDS=(5,9,CH,A)                     
  OUTFIL VTOF,REMOVECC,NODETAIL,BUILD=(80X), 
  SECTIONS=(5,9,TRAILER3=(5,9,COUNT))         
//*     


Billy boyo,

Since his input is a VB file , you need to have the RDW on the build statement or else you will get an ICE251A about missing RDW.
Kolusu - DFSORT Development Team (IBM)
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
skolusu
 
Posts: 586
Joined: Wed Apr 02, 2008 10:38 pm
Has thanked: 0 time
Been thanked: 39 times

Re: Count duplicates

Postby BillyBoyo » Tue Sep 04, 2012 10:24 pm

Sorry, slack of me. Must have copied the wrong JCL... Problem with having "identical" file names except for FB or VB. Not so much to change, but have to remember to actually change it... :-)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post