Page 1 of 1

How to sum decimal number using sort

PostPosted: Mon Nov 21, 2011 7:36 pm
by prabu_krish
Hi All,
i am facing s0c7 issue while summing on decimal fields(eg.0000000004.5).input/output record length of the file is 52.

SORT CARD:
SORT FIELDS=(1,40,CH,A)
SUM FIELDS=(41,12,ZD)

INPUT RECORD:
00313122700000687800000000100020000128140000000004.0
00313122700000687800000000100020000128140000000004.5
00313122700000687800000000100020000128140000000004.5
00313122700000687800000000100020000128140000000004.0


Hope its clear, Thanks for your help.

Re: How to sum decimal number using sort

PostPosted: Mon Nov 21, 2011 9:52 pm
by skolusu
prabu_krish,

You need to use the UFF format to sum data with explicit decimal point.

//STEP0100 EXEC PGM=SORT                               
//SYSOUT   DD SYSOUT=*                                 
//SORTIN   DD *                                       
----+----1----+----2----+----3----+----4----+----5----+
00313122700000687800000000100020000128140000000004.0   
00313122700000687800000000100020000128140000000004.5   
00313122700000687800000000100020000128140000000004.5   
00313122700000687800000000100020000128140000000004.0   
//SORTOUT  DD SYSOUT=*                                 
//SYSIN    DD *                                       
  SORT FIELDS=(1,40,CH,A),EQUALS                       
  OUTFIL REMOVECC,NODETAIL,                           
  SECTIONS=(1,40,                                     
  TRAILER3=(1,40,TOT=(41,12,UFF,EDIT=(TTTTTTTTTT.T))))
//*

Re: How to sum decimal number using sort

PostPosted: Tue Nov 22, 2011 2:52 pm
by prabu_krish
Hi skolusu,

Thanks a lot, its working fine. To understand better, can you provide a link which describe the above sort fields?

Thanks

Re: How to sum decimal number using sort

PostPosted: Tue Nov 22, 2011 2:58 pm
by BillyBoyo
Have a look at Kolusu's "sig" at the bottom of his post.

Re: How to sum decimal number using sort

PostPosted: Tue Nov 22, 2011 10:51 pm
by skolusu
prabu_krish,

If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/support/docview.wss? ... g3T7000080

Re: How to sum decimal number using sort

PostPosted: Wed Nov 23, 2011 1:37 pm
by prabu_krish
Hi skolusu,

thanks again!! :)