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 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: 2287
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 Inefficient BUILD - VB records paddin... Daniel Prosser SYNCSORT 4 Thu Dec 14, 2017 3:52 pm
No new posts ISSUE IN copying Sequential file reco... thesumitk JCL & VSAM 2 Wed Dec 13, 2017 3:07 pm
No new posts Merging 2 records at multiple rows wi... Bijesh DFSORT/ICETOOL 2 Wed Dec 06, 2017 1:50 am
No new posts ISMF Difference between volume count ... upendrasri IBM Tools 2 Tue Dec 05, 2017 12:40 pm
No new posts Increment number for every group of r... srajendran2 DFSORT/ICETOOL 7 Thu Nov 09, 2017 10:31 pm

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