Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts How to insert a value on specific pos... Poha Eater DFSORT/ICETOOL 9 Sun Oct 01, 2017 3:04 am
No new posts Partial color change of a field in CI... waseem0424 CICS 5 Fri Sep 29, 2017 7:56 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us