MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Sort sum multiple rows & update a new column

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
anu.k
Beginner


Joined: 09 Nov 2006
Posts: 6
Topics: 4

PostPosted: Tue Jul 13, 2010 3:12 pm    Post subject: Sort sum multiple rows & update a new column Reply with quote

Hi,

My requirement is to capture yearly amount based on monthly figures. Right now, the year-amt is 0. Need to sum-up and capture yearly amount as of that month.

Key is 1-132 bytes.
Code:

DATE               - X(10)
Account details    - X(122)
Month amount       - S9(16)V99
Year amount        - S9(10)V99

Sample input:
Code:

Date                            Account details             month-amt       year-amt
------------                    ----------------            -------------  -----------
2010-01-01                       ABC                        100                 0
2010-01-01                       DEF                        400                 0
2010-02-01                       ABC                        500                 0
2010-03-01                       ABC                          0                 0
2010-03-01                       DEF                        100                 0
2010-04-01                       ABC                         50                 0
2010-05-01                       ABC                        200                 0

Output should be like :
Code:

Date        Account details   month-amt      year-amt
----------  ----------------  -------------  -----------
2010-01-01   ABC              100            100
2010-01-01   DEF              400            400
2010-02-01   ABC              500            600
2010-03-01   ABC                0            600
2010-03-01   DEF              100            700
2010-04-01   ABC               50            650
2010-05-01   ABC              200            850

Please advice with some SORT solution.

Thanks,
Anu
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12380
Topics: 75
Location: San Jose

PostPosted: Tue Jul 13, 2010 4:22 pm    Post subject: Reply with quote

anu.k,

Something Doesn't make sense. How did the record

2010-03-01 DEF 100 get 700 as total? Shouldn't it be 500??

Also if you are summing a 18 byte field , how can you expect it to fit in a 12 byte field for year amount?
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group