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: 2285
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 column with count of rows within dist... ronald wouterson DB2 4 Sun Sep 17, 2017 9:48 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts SORT Trailer Count - LRECL Output co... amorante DFSORT/ICETOOL 5 Tue Aug 29, 2017 8:57 pm
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 21 Sun Aug 27, 2017 10:35 pm
This topic is locked: you cannot edit posts or make replies. Limit access to certain RACF group cvnlynn CLIST & REXX 5 Wed Aug 23, 2017 2:28 am

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