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 

Summing fields in SORT

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


Joined: 13 May 2003
Posts: 18
Topics: 9
Location: Indore,India

PostPosted: Tue Dec 16, 2003 6:50 am    Post subject: Summing fields in SORT Reply with quote

My input is :

aa 10.1
aa 20.1
bb 30.1
cc 40.1
dd 50.1
dd 60.2

I want following output:

aa 30.2
bb 30.1
cc 40.1
dd 110.3

How can I do it with SUM FIELDS or any other option in SORT.
Back to top
View user's profile Send private message
Prayank
Beginner


Joined: 13 May 2003
Posts: 18
Topics: 9
Location: Indore,India

PostPosted: Tue Dec 16, 2003 7:14 am    Post subject: Reply with quote

One more question :

Lets say my input records are (shown in hex) :

14CCCC
701111
-----------
14CCCC
902222

I want to use get following output:

23 AAAA
25 BBBB

How can I use outrec fields for this ?
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


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

PostPosted: Tue Dec 16, 2003 7:25 am    Post subject: Reply with quote

Prayank,

Please search before posting. check this topic which discusses the summing of records with imbedded decimal point.

http://www.mvsforums.com/helpboards/viewtopic.php?t=1374

Hope this helps...

cheers

kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Tue Dec 16, 2003 10:21 am    Post subject: Reply with quote

Prayank,

Here's a DFSORT job for the SUM you want:

Code:

//S1    EXEC  PGM=ICEMAN                     
//SYSOUT    DD  SYSOUT=*                     
//SORTIN DD *                                 
aa      10.1                                 
aa      20.1                                 
bb      30.1                                 
cc      40.1                                 
dd      50.1                                 
dd      60.2                                 
//SORTOUT  DD SYSOUT=*                       
//SYSIN    DD    *                           
* Get ZD value without decimal point         
  INREC FIELDS=(1,2, key                       
     3:8,3,    digits before decimal point     
     6:12,1)   digit after decimal point       
  SORT FIELDS=(1,2,CH,A)                       
  SUM FIELDS=(3,4,ZD)                         
  OUTREC FIELDS=(1,2,  key                     
     8:3,4,ZD,EDIT=(ITT.T),                   
     80:X)                                     
/*


And here's a DFSORT job to display the 1-byte binary value:

Code:

//S2    EXEC  PGM=ICEMAN                   
//SYSOUT    DD  SYSOUT=*                   
//SORTIN DD *                               
  AAAA     (Position 1 has X'17')                                 
  BBBB     (Position 1 has X'19')                                 
//SORTOUT  DD SYSOUT=*                     
//SYSIN    DD    *                         
  OPTION COPY                               
  OUTREC FIELDS=(1,1,BI,EDIT=(TT),80:X)     
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
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