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 

SYNSORT - aggregate and sum up character (ZD) fields

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


Joined: 19 Mar 2007
Posts: 13
Topics: 5

PostPosted: Mon Feb 15, 2016 11:16 pm    Post subject: SYNSORT - aggregate and sum up character (ZD) fields Reply with quote

I have a requirement to SORT and sum 'score' and 'revenue' fields. All the fields are character format.

Sample input record:
Code:

----+----1----+----2----+----3----+----4----
01,XXXXX,2016-02-09,ABC,00008,000000169.000
01,XXXXX,2016-02-09,ABC,00007,000000000.000
01,YYYYY,2016-02-09,ABC,00001,000000109.000
01,YYYYY,2016-02-09,XYZ,00069,000000129.000
01,YYYYY,2016-02-09,XYZ,00001,000000169.000


SORT CARD:
Code:

SORT FIELDS=(01,02,CH,A,
             04,05,CH,A,
             11,10,CH,A,
             21,03,CH,A)
                       
SUM FIELDS=(25,05,ZD,        ==> Score field
            31,13,ZD)                ==> revenue field


SORT failed to sum the revenue fields since it has decimal point. It works fine with score alone. I am using SYNCSORT. Please help.
Back to top
View user's profile Send private message
William Collins
Supermod


Joined: 03 Jun 2012
Posts: 437
Topics: 0

PostPosted: Tue Feb 16, 2016 2:24 am    Post subject: Reply with quote

If you have to SORT the data, why do you show sample data which is in sequence? Since the data is obviously not of a type of ZD, can you find in your documentation a type which would describe your data and which you can use in SUM?
Back to top
View user's profile Send private message
ssanthosh
Beginner


Joined: 19 Mar 2007
Posts: 13
Topics: 5

PostPosted: Tue Feb 16, 2016 8:56 am    Post subject: Reply with quote

Bill, Only first few records are sorted not all. I am able to sum the scores (numeric column) but not revenue, since revenue has decimal point. Please advise.
Back to top
View user's profile Send private message
William Collins
Supermod


Joined: 03 Jun 2012
Posts: 437
Topics: 0

PostPosted: Tue Feb 16, 2016 9:11 am    Post subject: Reply with quote

You're going to have to use INREC (I assume you've consulted your documentation and found no useful data-type for SUM) to turn your character-number into a ZD. Since it seems that your data is all at fixed positions, temporarily extend the record with the data at 31,10 and 42,2 (ie ignoring the decimal-point) and SUM on that field. In OUTREC, use BUILD to relocate the summed value to its correct position (leaving the decimal-point unchanged), and return the record to its original size.
Back to top
View user's profile Send private message
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