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

Count the no of duplicate records and insert it into a field


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

New User


Joined: 21 Feb 2008
Posts: 18
Location: Mumbai

PostPosted: Thu Feb 21, 2008 3:32 pm
Reply with quote

Hi,

I have a file looking like this.

ACCT-NO TOTAL-NO-OF-PAGES
aaaaa X
aaaaa X
bbbbbb X
bbbbbb X
bbbbbb X
ccccccc X
ccccccc X

I want to count the no. of records for each account(for e.g. for account no. 'aaaaa' no-of-records is 2) and write correspoding to each account.

The resultant file should look like this

ACCT-NO TOTAL-NO-OF-PAGES
aaaaa 2
aaaaa 2

bbbbbb 3
bbbbbb 3
bbbbbb 3
ccccccc 2
ccccccc 2

Can anybody help me on this. Is it possible by SORT utility.

Thanks in advance.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Feb 21, 2008 10:27 pm
Reply with quote

chiru_sh,

Here's a DFSORT/ICETOOL job that will do what you asked for. I assumed your key was in positions 1-10, but you can change it appropriately by changing the ACCTNO symbol.

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//SYMNAMES DD *
ACCTNO,1,10,CH
/*
//IN DD DSN=...  input file
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//CON DD DSN=*.T1,VOL=REF=*.T1,DISP=(OLD,PASS)
//    DD DSN=... input file
//OUT DD DSN=...  output file
//TOOLIN DD *
SORT FROM(IN) TO(T1) USING(CTL1)
SPLICE FROM(CON) TO(OUT) ON(ACCTNO) WITHALL WITH(ACCTNO) USING(CTL2)
/*
//CTL1CNTL DD *
  SORT FIELDS=(ACCTNO,A)
  OUTFIL FNAMES=T1,NODETAIL,REMOVECC,
    SECTIONS=(ACCTNO,
      TRAILER3=(ACCTNO,27:COUNT=(M10,LENGTH=3)))
/*
//CTL2CNTL DD *
  OUTFIL FNAMES=OUT,REMOVECC,                     
    HEADER2=('ACCT-NO',13:'TOTAL-NO-OF-PAGES')   
/*


OUT will have:

Code:

ACCT-NO     TOTAL-NO-OF-PAGES 
aaaaa                       2 
aaaaa                       2 
bbbbbb                      3 
bbbbbb                      3 
bbbbbb                      3 
ccccccc                     2 
ccccccc                     2 
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 Duplicate transid's declared using CEDA CICS 3
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
Search our Forums:

Back to Top