View previous topic :: View next topic
|
Author |
Message |
fazilbe
New User
Joined: 03 Dec 2008 Posts: 25 Location: INDIA
|
|
|
|
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 |
|
|
vinothsubramanian
New User
Joined: 01 Sep 2006 Posts: 39 Location: Chennai, India
|
|
|
|
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 |
|
|
fazilbe
New User
Joined: 03 Dec 2008 Posts: 25 Location: INDIA
|
|
|
|
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 |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
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 |
|
|
Bill Dennis
Active Member
Joined: 17 Aug 2007 Posts: 562 Location: Iowa, USA
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
I suspect you want to use a TRAILER. . .
Which sort product is used on this system? |
|
Back to top |
|
|
vinothsubramanian
New User
Joined: 01 Sep 2006 Posts: 39 Location: Chennai, India
|
|
|
|
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 |
|
|
|