Preetha Ramkumar
New User
Joined: 07 Mar 2006 Posts: 9 Location: Hyderabad
|
|
|
|
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. |
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
Preetha Ramkumar
New User
Joined: 07 Mar 2006 Posts: 9 Location: Hyderabad
|
|
|
|
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 .
Regards,
Preetha |
|