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 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 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