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
 
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: 2294
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 Increment number for every group of r... srajendran2 DFSORT/ICETOOL 7 Thu Nov 09, 2017 10:31 pm
This topic is locked: you cannot edit posts or make replies. Can a alphanumeric data be moved to a... nico_neoz COBOL Programming 10 Mon Oct 30, 2017 8:28 am
No new posts Copying part of the report using SARBCH Aedulla CA Products 1 Tue Oct 24, 2017 9:24 am
No new posts column with count of rows within dist... ronald wouterson DB2 4 Sun Sep 17, 2017 9:48 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