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 

Is this possible using SORT..?

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


Joined: 04 Feb 2003
Posts: 113
Topics: 37

PostPosted: Thu Jun 19, 2003 11:00 am    Post subject: Is this possible using SORT..? Reply with quote

Hi,
Is this possible using SORT..?
Code:

Input:

Chandra     300.05
Chandra     -50.15
Guru        500.00
Guru       -100.15
Senthil     200.25
Senthil    -100.35

Expected output
------------------
Chandra    249.90 
Guru       399.85
Senthil    99.90



Thanks
-Somu


Last edited by somuk on Fri Jun 20, 2003 8:25 am; edited 1 time in total
Back to top
View user's profile Send private message Yahoo Messenger
Dibakar
Advanced


Joined: 02 Dec 2002
Posts: 700
Topics: 63
Location: USA

PostPosted: Fri Jun 20, 2003 12:23 am    Post subject: Reply with quote

Hi somu,

Look at solution by coolman .

Regards,
Dibakar.
Back to top
View user's profile Send private message Send e-mail
somuk
Beginner


Joined: 04 Feb 2003
Posts: 113
Topics: 37

PostPosted: Fri Jun 20, 2003 7:06 am    Post subject: Reply with quote

Hi Dibakar,
Thanks.. But my input and output have a decimal point. So need to know how do we SUM numbers with a decimal point and get the required output..?

Thanks
-Somu
Back to top
View user's profile Send private message Yahoo Messenger
Alain Benveniste
Beginner


Joined: 04 May 2003
Posts: 92
Topics: 4
Location: Paris, France

PostPosted: Fri Jun 20, 2003 12:15 pm    Post subject: Reply with quote

Somuk,

just customise the "Sum a number with a decimal point" Smart DFSORT Trick to your needs:

http://www.ibm.com/servers/storage/support/software/sort/mvs/tricks/

Take advantage of the other Smart DFSORT Tricks at:

http://www.ibm.com/servers/storage/support/software/sort/mvs/tricks/

Alain
Back to top
View user's profile Send private message
somuk
Beginner


Joined: 04 Feb 2003
Posts: 113
Topics: 37

PostPosted: Fri Jun 20, 2003 2:17 pm    Post subject: Reply with quote

Thanks Alain.. That is what exactly I'm looking for..
_________________
Regds,
Somu
Back to top
View user's profile Send private message Yahoo Messenger
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


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

PostPosted: Wed Dec 29, 2004 11:28 am    Post subject: Reply with quote

With z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 (Dec, 2004), you can use the new SFF (signed free form) format to do this more easily and efficiently in either of the following two ways:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
Chandra     300.05
Chandra     -50.15
Guru        500.00
Guru       -100.15
Senthil     200.25
Senthil    -100.35
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  OUTFIL REMOVECC,NODETAIL,
    SECTIONS=(1,7,
* Use SFF to convert sddd.dd to ZD. Total the ZD values
* for each key and display the total as sddd.dd.
      TRAILER3=(1,7,12:TOT=(12,7,SFF,EDIT=(SIIT.TT),SIGNS=(,-))))
/*


Code:

//S2    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD *
Chandra     300.05
Chandra     -50.15
Guru        500.00
Guru       -100.15
Senthil     200.25
Senthil    -100.35
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
* Use SFF to convert sddd.dd to ZD.
  INREC OVERLAY=(12:12,7,SFF,TO=ZD)
* Sort on the key.
  SORT FIELDS=(1,7,CH,A)
* Sum the ZD values.
  SUM FIELDS=(12,7,ZD)
* Display the ZD total as sddd.dd.
  OUTREC OVERLAY=(12:12,7,ZD,EDIT=(SIIT.TT),SIGNS=(,-))


In both cases, SORTOUT will have:

Code:

Chandra     249.90
Guru        399.85
Senthil      99.90



For complete information on all of the new DFSORT and ICETOOL functions available with these DFSORT PTFs, see:

www.ibm.com/servers/storage/support/software/sort/mvs/pdug/
_________________
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