IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Sum up values in three different columns


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Savitha Muthukrishnan

New User


Joined: 31 Dec 2006
Posts: 8
Location: Chennai

PostPosted: Fri May 16, 2008 7:32 pm
Reply with quote

Hi,

Iam trying to sum up values on three different columns and write the summed value into a fourth column. Can someone please tell me how i could do it using a jcl.

e.g. i have a file with values in three columns as :

10 20 30

I need to sum 10+20+30 and write a fourth column as 60.

Thanks
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri May 16, 2008 10:15 pm
Reply with quote

You can use a DFSORT job like the following to do what you asked for. I guessed at the positions and length of the fields. Adjust as needed.

Code:

//S1    EXEC  PGM=ICEMAN                                         
//SYSOUT    DD  SYSOUT=*                                         
//SORTIN DD *                                                     
10 20 30                                                         
//SORTOUT DD SYSOUT=*                                             
//SYSIN    DD    *                                               
  OPTION COPY                                                     
  INREC OVERLAY=(10:1,2,ZD,ADD,4,2,ZD,ADD,7,2,ZD,EDIT=(TT))   
/*


SORTOUT would have:

Code:

10 20 30 60
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Remote Unload of CLOB Columns DB2 6
No new posts Increase the number of columns in the... IBM Tools 3
No new posts Null values are considered in Total c... DFSORT/ICETOOL 6
Search our Forums:

Back to Top