Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups 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
Author Message
Savitha Muthukrishnan

New User


Joined: 31 Dec 2006
Posts: 2
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
References
PostPosted: Fri May 16, 2008 7:32 pm    Post subject: Re: Sum up values in three different columns Reply with quote

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 3978
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
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL All times are GMT + 6 Hours
Page 1 of 1