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
 

 

DFSORT SUM and RECORD Count

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

Active User


Joined: 17 Mar 2006
Posts: 171
Location: Bangalore

PostPosted: Sun Jan 01, 2012 10:00 pm    Post subject: DFSORT SUM and RECORD Count
Reply with quote

Hi,

Below is the Input file FB, LRECL=80
Code:
090600           -0.43
090600           -0.43
090601           -0.43
090601           -0.43
090601            0.00
090602           -0.43
090602           -0.43
090602           -0.43
090602           -0.43


Output:-

Code:
   Summary Report
   ---------------
Account#   Amount   Count
--------   ------   -----
090600      -1.28   3
090601      -0.86   2
090602      -1.70   4
           ------  ---
Total       -3.84   9
Back to top
View user's profile Send private message

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7306

PostPosted: Sun Jan 01, 2012 10:13 pm    Post subject: Re: DFSORT SUM and RECORD Count
Reply with quote

You mean:

Input Data

Magic

Output Data

You have two 090600 and three 090601 on your input, and the reverse on your output. Is this is typo? Or do you have some rules to achieve that?

There are a lot of simple report example in the Getting Started and Programming Guides.
Back to top
View user's profile Send private message
shrivatsa
Warnings : 1

Active User


Joined: 17 Mar 2006
Posts: 171
Location: Bangalore

PostPosted: Mon Jan 02, 2012 2:52 pm    Post subject:
Reply with quote

Sorry its Typo error. The output should be as below.



Code:
   Summary Report
   ---------------
Account#   Amount   Count
--------   ------   -----
090600      -1.28   2
090601      -0.86   3
090602      -1.70   4
           ------  ---
Total       -3.84   9
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Tue Jan 03, 2012 5:57 am    Post subject:
Reply with quote

You need to work on your arithmetic. The correct output for your input example would be:

Code:

Summary Report
--------------
Account#   Amount   Count
--------   ------   -----
090600      -0.86       2
090601      -0.86       3
090602      -1.72       4
-----      ------   -----
Total       -3.44       9


You can use a DFSORT job like the following:

Code:

//S1 EXEC PGM=SORT                                               
//SYSOUT DD SYSOUT=*                                             
//SORTIN DD *                                                   
090600           -0.43                                           
090600           -0.43                                           
090601           -0.43                                           
090601           -0.43                                           
090601            0.00                                           
090602           -0.43                                           
090602           -0.43                                           
090602           -0.43                                           
090602           -0.43                                           
//SORTOUT DD SYSOUT=*                                           
//SYSIN DD *                                                     
  SORT FIELDS=(1,6,CH,A)                                         
  OUTFIL REMOVECC,NODETAIL,                                     
    HEADER2=('Summary Report',/,14'-',2/,                       
     'Account#',12:'Amount',21:'Count',/,                       
     8'-',12:6'-',21:5'-'),                                     
    SECTIONS=(1,6,                                               
     TRAILER3=(1,6,13:TOT=(18,5,SFF,EDIT=(ST.TT),SIGNS=(,-)),   
       21:COUNT=(M10,LENGTH=5))),                               
    TRAILER1=(5'-',12:6'-',21:5'-',/,                           
       'Total',                                                 
       13:TOT=(18,5,SFF,EDIT=(ST.TT),SIGNS=(,-)),               
       21:COUNT=(M10,LENGTH=5))                         
/*       
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 Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts Display FTP Session Count within TSO Yolanda Harvey TSO/ISPF 3 Fri Mar 10, 2017 10:31 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts DFSORT MUL FIELDS tspr52 DFSORT/ICETOOL 16 Fri Mar 03, 2017 11:53 pm
No new posts To Merge mutliple records into a sing... anandgbe DFSORT/ICETOOL 6 Wed Feb 22, 2017 8:49 am


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