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
 
Sum up values in three different columns

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Sum up values in three different columns
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 Moderator


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

PostPosted: Fri May 16, 2008 10:15 pm    Post subject:
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    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 Extend the decimal values in DIVISION Balaryan DFSORT/ICETOOL 3 Thu Oct 05, 2017 4:05 pm
No new posts Working with hex values in Filemanage... Emile Straker IBM Tools 0 Tue Sep 12, 2017 1:42 am
No new posts DB2 NULL Values display V S Amarendra Reddy DB2 3 Thu Sep 07, 2017 6:59 pm
No new posts Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm
No new posts BI,TO=ZD Changing Values Tyler Dunbar DFSORT/ICETOOL 4 Tue Jul 25, 2017 12:12 am

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