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
 
Record Count and Sum Amount for each type of data

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

New User


Joined: 05 Nov 2005
Posts: 12

PostPosted: Thu Feb 11, 2010 1:36 pm    Post subject: Record Count and Sum Amount for each type of data
Reply with quote

Can you please show me how I can use sort to count and sum amount based on specific record types? I want the output to show me the type, record count for the type, and sum amount for the type. Then if possible, show a trailer record with the total count and total sum amount.

Input:

TYPE AMOUNT PIC 9(07)V99

AAA 0530
CCC 0100
BBB 0200
AAA 1050
CCC 0100
BBB 0420
CCC 0310

Output:

TYPE COUNT AMOUNT
AAA 2 15.80
BBB 2 06.20
CCC 3 05.10

TOTAL 7 27.10



Thanks in advance.
Back to top
View user's profile Send private message

Skolusu

Senior Member


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

PostPosted: Thu Feb 11, 2010 10:25 pm    Post subject: Reply to: Record Count and Sum Amount for each type of data
Reply with quote

newbie,

Use the following DFSORT JCL

Code:

//STEP0100 EXEC PGM=SORT                                 
//SYSOUT   DD SYSOUT=*                                   
//SORTIN   DD *                                         
AAA 000000530                                           
CCC 000000100                                           
BBB 000000200                                           
AAA 000001050                                           
CCC 000000100                                           
BBB 000000420                                           
CCC 000000310                                           
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD *                                         
  SORT FIELDS=(1,3,CH,A)                                 
  OUTFIL REMOVECC,NODETAIL,BUILD=(80X),                 
  SECTIONS=(1,3,                                         
  TRAILER3=(1,3,5X,COUNT=(M10,LENGTH=8),2X,             
                  TOTAL=(5,9,ZD,EDIT=(IIIIIIIT.TT)))),   
  TRAILER1=(9:8C'=',X,12C'=',/,                         
            'TOTAL : ',COUNT=(M10,LENGTH=8),X,           
             TOTAL=(5,9,ZD,EDIT=(IIIIIIIIT.TT)))         
//*


The output is
Code:

AAA            2        15.80
BBB            2         6.20
CCC            3         5.10
        ======== ============
TOTAL :        7        27.10
Back to top
View user's profile Send private message
newbie

New User


Joined: 05 Nov 2005
Posts: 12

PostPosted: Fri Feb 12, 2010 5:13 am    Post subject: Reply to: Record Count and Sum Amount for each type of data
Reply with quote

Skolusu, thanks a lot. icon_biggrin.gif
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 How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
No new posts Copy 4 byte of data from the last rec... arunsoods DFSORT/ICETOOL 9 Fri Oct 06, 2017 12:15 pm
No new posts opening a dataset after reading it fr... arunsoods DFSORT/ICETOOL 5 Wed Oct 04, 2017 3:54 pm
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am

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