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 Using ICETOOL, how we can seperate th... bshkris SYNCSORT 5 Tue May 09, 2017 8:33 pm
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts Alter &DATENS field in HEADER1 Angad DFSORT/ICETOOL 4 Mon Apr 24, 2017 11:49 am


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