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 COB2 file processing rizwanaccy COBOL Programming 8 Tue Jan 02, 2018 1:00 pm
No new posts KSDS and Index file in cobol deepak14450 COBOL Programming 9 Fri Dec 22, 2017 9:36 am
No new posts Preserve order in Input File pshongal DFSORT/ICETOOL 13 Thu Dec 21, 2017 4:20 pm
No new posts ISSUE IN copying Sequential file reco... thesumitk JCL & VSAM 2 Wed Dec 13, 2017 3:07 pm
No new posts File Tailoring -- Temporary dataset i... samzee71 CLIST & REXX 3 Fri Dec 01, 2017 3:12 am

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