Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

SUM FIELD issue

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
fazilbe

New User


Joined: 03 Dec 2008
Posts: 25
Location: INDIA

PostPosted: Fri Jun 26, 2009 5:21 pm    Post subject: SUM FIELD issue
Reply with quote

Hi all.

I want to total the amount present in each record of a file and post the result in different file or the same file. Please find the example below

xxxxx 23
yyyyy 40
zzzzz 45

out of the 3 records, i want the numbers 20,40 and 45 to be added up and the result be posted in the same file or different. Can someone provide me with the Control card to do the same. I tried the below one but it did not work.

SORT FIELDS=COPY
SUM FIELDS=(8,2,ZD)

Regards,
Fazil
Back to top
View user's profile Send private message

vinothsubramanian

New User


Joined: 01 Sep 2006
Posts: 39
Location: Chennai, India

PostPosted: Fri Jun 26, 2009 6:13 pm    Post subject:
Reply with quote

HI,

Sort fields=copy and Sum Fields= cannot be used together. You should have a valid sort field (other than COPY) for the sum fields to work.

In your case the control cards can be:
Code:
SORT FIELDS=(6,1,CH,A)
SUM FIELDS=(7,2,ZD)


Regards,
Ram.
Back to top
View user's profile Send private message
fazilbe

New User


Joined: 03 Dec 2008
Posts: 25
Location: INDIA

PostPosted: Fri Jun 26, 2009 6:22 pm    Post subject: Reply to: SUM FIELD issue
Reply with quote

Ram,

Thanks for the reply.

But that works only when the key field is unique. I want to add up all the numbers irrespective of the key field and post the result. Does that make sense?

Regards,
Fazil
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Fri Jun 26, 2009 8:14 pm    Post subject: Re: Reply to: SUM FIELD issue
Reply with quote

fazilbe wrote:
I want to add up all the numbers irrespective of the key field and post the result. Does that make sense?
Please show some better example of input and the expected output from that.
Back to top
View user's profile Send private message
Bill Dennis

Active Member


Joined: 17 Aug 2007
Posts: 562
Location: Iowa, USA

PostPosted: Sat Jun 27, 2009 1:32 am    Post subject: Re: Reply to: SUM FIELD issue
Reply with quote

fazilbe wrote:
Ram,

Thanks for the reply.

But that works only when the key field is unique.
Ram was having you sort on the apparent BLANK between fields so all recs can be SUMmed.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Sat Jun 27, 2009 1:39 am    Post subject:
Reply with quote

Hello,

I suspect you want to use a TRAILER. . .

Which sort product is used on this system?
Back to top
View user's profile Send private message
vinothsubramanian

New User


Joined: 01 Sep 2006
Posts: 39
Location: Chennai, India

PostPosted: Mon Jun 29, 2009 5:15 pm    Post subject:
Reply with quote

Hi,

You can use this:

Code:
INREC FIELDS=(1,80,81:C'1')   
SORT FIELDS=(81,1,CH,A)       
SUM FIELDS=(7,2,ZD)           
OUTREC BUILD=(1,80)           


Regards,
Ram.
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 VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts outrec field outside range Danielle.Filteau SYNCSORT 10 Sat Mar 04, 2017 2:37 am
No new posts 2 byte YEAR from Y'DATE2' field tecnokrat DFSORT/ICETOOL 2 Tue Feb 07, 2017 12:05 pm
No new posts Sort two file having same field, one ... himanshu malik DFSORT/ICETOOL 7 Thu Feb 02, 2017 10:09 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us