Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Count the no of duplicate records and insert it into a field
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 Moderator


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

PostPosted: Thu Feb 21, 2008 10:27 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Sort Card to Remove Duplicate records... raj4neo SYNCSORT 2 Wed Jan 25, 2017 4:44 am
No new posts INVALID FIELD OR CONSTANT IN SORTOF ?? Ron Klop DFSORT/ICETOOL 8 Wed Jan 11, 2017 3:44 pm
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 31 Tue Dec 06, 2016 8:04 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us