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

SUM FIELD issue


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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
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
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

Superior Member


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

PostPosted: Fri Jun 26, 2009 8:14 pm
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
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

Moderator Emeritus


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

PostPosted: Sat Jun 27, 2009 1:39 am
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Join 2 files according to one key field. JCL & VSAM 3
No new posts Issue after ISPF copy to Linklist Lib... TSO/ISPF 1
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
Search our Forums:

Back to Top