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
 

 

Use WHEN=GROUP for simple report

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
rmd3003

New User


Joined: 03 Jul 2006
Posts: 53

PostPosted: Wed Jul 14, 2010 6:18 am    Post subject: Use WHEN=GROUP for simple report
Reply with quote

I have input file like this

Code:

ABC    001    1
ABC    099    1
ABC    050    1
XYZ    010    5
XYZ    010    5
XYZ    010    5
XYZ    010    5


I need to group by first three bytes and summarize. At the end I also need trailer with totals. Output should look like this

Code:
NAME   AMT    CNT
-----------------
ABC    150    3 
XYZ    040    20
-----------------
TOTAL  190    23


Thank you.
Back to top
View user's profile Send private message

Arun Raj

Moderator


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

PostPosted: Wed Jul 14, 2010 3:28 pm    Post subject:
Reply with quote

I guess you can achieve this using SECTIONS,TRAILER3 (section trailers)and a TRAILER1(report trailer) without really going for a WHEN=GROUP
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed Jul 14, 2010 10:11 pm    Post subject:
Reply with quote

rmd3003,

The following DFSORT JCL will give you the desired results

Code:

//STEP0100 EXEC PGM=SORT                       
//SYSOUT   DD SYSOUT=*                         
//SORTIN   DD *                                 
ABC    001    1                                 
ABC    099    1                                 
ABC    050    1                                 
XYZ    010    5                                 
XYZ    010    5                                 
XYZ    010    5                                 
XYZ    010    5                                 
//SORTOUT  DD SYSOUT=*                         
//SYSIN    DD *                                 
  SORT FIELDS=COPY                             
  OUTFIL REMOVECC,NODETAIL,                     
  HEADER1=('NAME   AMT    CNT',/,               
           '-----------------'),               
  SECTIONS=(1,3,                               
  TRAILER3=(1,3,2X,                             
            TOT=(8,3,ZD,M10,LENGTH=5),2X,       
            TOT=(15,1,ZD,M10,LENGTH=5))),       
  TRAILER1=('-----------------',/,             
            'TOTAL',                           
            TOT=(8,3,ZD,M10,LENGTH=5),2X,       
            TOT=(15,1,ZD,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:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Report cost in CA-dispatch Nileshkul CA Products 3 Wed Jun 07, 2017 10:32 pm
No new posts find RACF group for access to spooled... jzhardy JCL & VSAM 1 Mon May 08, 2017 11:46 am
No new posts Group Data based on a key Arun Raj DFSORT/ICETOOL 7 Thu Apr 27, 2017 11:29 pm
No new posts Need Help with : IFTHEN(WHEN=GROUP) Sumanta_89 DFSORT/ICETOOL 1 Wed Apr 19, 2017 5:23 pm
No new posts Group elements using ICETOOL Learncoholic DFSORT/ICETOOL 2 Fri Apr 14, 2017 11:01 am


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