IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Counting the number of records while sorting.


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Preetha Ramkumar

New User


Joined: 07 Mar 2006
Posts: 9
Location: Hyderabad

PostPosted: Sat Dec 09, 2006 11:09 pm
Reply with quote

Its all about sort cards.

See I have a file for eg,

route1 tvm
route2 ekm
route3 thr
route5 knr
route1 abc
route2 def
route3 ghi
route5 hij

I'm going to sort this based on route code:

ie the o/p will look like:

route1 abc
route1 tvm
route2 def
route2 ekm etc........

While sorting i need to get the count of records that comes under a particular route.ie,my purpose is to get the o/p like:

route count

route1 2
route2 2 etc......

Is this possible using a single sort card?I have heard of teh optio of using Count in sort cards.Not sure abt teh syntax.Have u used any time.Need a reply at the earliest.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Sun Dec 10, 2006 6:15 am
Reply with quote

This belongs in the DFSORT or JCL Forum, not in the Suggestions and Feedback Forum.

Here are a couple of ways to do this with DFSORT. Either one can be changed to format the output differently. If you need help doing that, tell me exactly what you want the output to look like.

Method 1: ICETOOL OCCUR

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=...  input file
//RPT DD DSN=...  output file
//TOOLIN DD *
OCCUR FROM(IN) LIST(RPT) BLANK -
  HEADER('route') ON(1,6,CH) -
  HEADER('count') ON(VALCNT,U05)
/*


Method 2: SECTIONS

Code:

//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file
//SORTOUT DD DSN=...  output file
//SYSIN    DD    *
  SORT FIELDS=(1,6,CH,A)
  OUTFIL REMOVECC,NODETAIL,
    SECTIONS=(1,6,
      TRAILER3=(1,6,X,COUNT=(M10,LENGTH=5)))
/*


If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

Use [URL] BBCode for External Links
Back to top
View user's profile Send private message
Preetha Ramkumar

New User


Joined: 07 Mar 2006
Posts: 9
Location: Hyderabad

PostPosted: Sun Dec 10, 2006 10:31 pm
Reply with quote

Hi Frank,

Thanks a lot for the detailed solution.I need to try this and revert if I face any problems.Also,thanks for the link on DFSORT icon_smile.gif .

Regards,
Preetha
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts Generate random number from range of ... COBOL Programming 3
No new posts Increase the number of columns in the... IBM Tools 3
Search our Forums:

Back to Top