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
 
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 IDCAMS RENAMING VSAM FILE ALONG WITH ... upendrasri JCL & VSAM 11 Tue Apr 17, 2018 10:42 pm
No new posts VSAM file NOT Found error while proce... SumaReva CICS 5 Wed Apr 11, 2018 9:54 pm
No new posts converting a mainframe file with ASA ... Lynne Schuler All Other Mainframe Topics 5 Wed Apr 04, 2018 9:44 am
No new posts VSAM File free space sancraig16 JCL & VSAM 13 Fri Mar 30, 2018 1:02 am
No new posts write multiple lines in PS file in cobol Balu5491 COBOL Programming 7 Wed Mar 07, 2018 10:27 am

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