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 Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 4 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


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