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 sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts Partial color change of a field in CI... waseem0424 CICS 5 Fri Sep 29, 2017 7:56 pm
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am

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