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
 

 

How to Calcualte monthwise subtotal from Input file

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

New User


Joined: 13 Jul 2007
Posts: 8
Location: Hyderabad

PostPosted: Tue May 05, 2009 9:38 pm    Post subject: How to Calcualte monthwise subtotal from Input file
Reply with quote

Hi All,

I have a requirement as below

Input file is already sorted on date

PREM_DATE PREM_AMT
--------------- --------------
11/10/2007 2000.00
11/25/2007 2500.00
12/10/2007 300.00
12/15/2007 100.00
01/05/2008 1250.00
01/15/2008 520.00
02/19/2008 1250.00
02/28/2008 520.00

Now, I want to calculate the subtotals of for each-month and want to write it into an output file.

also, I want to calculate the AVG for the column PREM_AMT.

Could anyone suggest me the SORTCARD for the above.
Back to top
View user's profile Send private message

Skolusu

Senior Member


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

PostPosted: Tue May 05, 2009 9:51 pm    Post subject: Reply to: How to Calcualte monthwise subtotal from Input fil
Reply with quote

Bhanupratap Natva,

use the following DFSORT JCL

Code:

//STEP0100 EXEC PGM=SORT                             
//SYSOUT   DD SYSOUT=*                               
//SORTIN   DD *                                     
11/10/2007 2000.00                                   
11/25/2007 2500.00                                   
12/10/2007 300.00                                   
12/15/2007 100.00                                   
01/05/2008 1250.00                                   
01/15/2008 520.00                                   
02/19/2008 1250.00                                   
02/28/2008 520.00                                   
//SORTOUT  DD SYSOUT=*                               
//SYSIN    DD *                                     
  SORT FIELDS=COPY                                   
  OUTFIL REMOVECC,                                   
  SECTIONS=(1,2,                                     
  TRAILER3=(/,'TOTAL FOR MONTH   ',1,2,' : ',       
             TOT=(12,10,UFF,EDIT=(IIIIIII.IT)),/,   
            'AVERAGE FOR MONTH ',1,2,' : ',         
             AVG=(12,10,UFF,EDIT=(IIIIIII.IT)),/))   
                                                     
/*


This will produce

Code:

11/10/2007 2000.00               
11/25/2007 2500.00               
                                 
TOTAL FOR MONTH   11 :    4500.00
AVERAGE FOR MONTH 11 :    2250.00
                                 
12/10/2007 300.00                 
12/15/2007 100.00                 
                                 
TOTAL FOR MONTH   12 :     400.00
AVERAGE FOR MONTH 12 :     200.00
                                 
01/05/2008 1250.00               
01/15/2008 520.00                 
                                 
TOTAL FOR MONTH   01 :    1770.00
AVERAGE FOR MONTH 01 :     885.00
                                 
02/19/2008 1250.00               
02/28/2008 520.00                 
                                 
TOTAL FOR MONTH   02 :    1770.00
AVERAGE FOR MONTH 02 :     885.00
                                 
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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 31 Tue Dec 06, 2016 8:04 pm
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 15 Thu Dec 01, 2016 8:28 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm


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