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 find the sum of a particular field in a file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
ayappanb
Warnings : 1

New User


Joined: 22 Feb 2007
Posts: 24
Location: Chennai

PostPosted: Tue Oct 30, 2007 7:06 pm    Post subject: How to find the sum of a particular field in a file
Reply with quote

My request is to find the sum of a particluar field in a file

Input

Code:

Name     PS no    mark1  mark2
ayappan  278250      60     90
roshan   276589      40     60
karil    234567      50     40


Output
I want to find the total of 'mark1'(60+40+50)
Output = 150
Back to top
View user's profile Send private message

krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Tue Oct 30, 2007 8:04 pm    Post subject:
Reply with quote

ayappanb
This SORT JOB would do what you needed, if this is not what you want please elaborate your requirement
Code:
//*******************************************************               
//STEP1    EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD *                                                         
AYAPPAN 278250 60 90                                                   
ROSHAN  276589 40 60                                                   
KARIL   234567 50 40                                                   
/*                                                                     
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                         
  SORT FIELDS=COPY                                                     
  OUTFIL NODETAIL,REMOVECC,                                             
         TRAILER1=(4:C'TOTAL=',15:TOT=(16,2,ZD,EDIT=(IIIT))               
/*                                                                     


SORTOUT contains:
Code:
   TOTAL      150   
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 -> JCL & VSAM 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 INVALID FIELD OR CONSTANT IN SORTOF ?? Ron Klop DFSORT/ICETOOL 8 Wed Jan 11, 2017 3:44 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 find particular member name in PDS us... ravi243 CLIST & REXX 10 Mon Dec 19, 2016 6:44 pm
No new posts Performing arithmetic on input field zh_lad DFSORT/ICETOOL 31 Tue Dec 06, 2016 8:04 pm


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