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 of group of similar records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
Lijo

New User


Joined: 24 Aug 2008
Posts: 41
Location: Cochin

PostPosted: Wed Sep 24, 2008 3:31 pm    Post subject: Count of group of similar records
Reply with quote

Hi,

I've a requirement to count group of similar records...

My input file has:
0100040000234560
0100040000234560
0100050000234556
6006570011587234
6006571158723401
6006571158723402

Output should be:
010004 - 2
010005 - 1
600657 - 3

Count should be taken based on first six characters (1,6,CH).
Can someone help me?
Back to top
View user's profile Send private message

Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed Sep 24, 2008 3:41 pm    Post subject:
Reply with quote

use sort card as below
Code:

//sysin dd *
  inrec fields=(1,6,7:c'001')
  sort fields=(1,6,ch)
  sum fields=(7,3,zd)
  outrec fields(1,6,7:c'-',7,3)
/*
 
Back to top
View user's profile Send private message
Lijo

New User


Joined: 24 Aug 2008
Posts: 41
Location: Cochin

PostPosted: Wed Sep 24, 2008 3:56 pm    Post subject:
Reply with quote

It's working absolutely fine as expected.

Thanks Sambhaji...
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed Sep 24, 2008 4:05 pm    Post subject:
Reply with quote

One correction..
Quote:

sort fields=(1,6,ch)

should be changed to

sort fields=(1,6,ch,a)
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2180
Location: @my desk

PostPosted: Wed Sep 24, 2008 4:32 pm    Post subject:
Reply with quote

Lijo,

If your input records are already in sorted order of the key, you can omit the INREC pass like this.
Code:
//SYSIN    DD *                                         
  OPTION COPY                                           
  OUTFIL REMOVECC,NODETAIL,                             
  SECTIONS=(1,6,TRAILER3=(1,6,C'-',COUNT=(M10,LENGTH=5)))

Code:
010004-    2
010005-    1
600657-    3
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Wed Sep 24, 2008 5:35 pm    Post subject:
Reply with quote

Quote:

Thanks Sambhaji...

You are welcome..
One more thing should be kept in mind here is prefixing enough number of zeros so that count (sum) will not overflow else it will fail.
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


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