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 VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts Display FTP Session Count within TSO Yolanda Harvey TSO/ISPF 3 Fri Mar 10, 2017 10:31 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am


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