DFsort Summing !!



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

DFsort Summing !!

Postby gokulNmf » Wed Jul 15, 2009 1:16 pm

Hi,
I am using sum fiels for summing based onthe alphabet in the first column, i am using the below jcl but i cldn get the
summed output.
can anyone help?

Thanks in Advance!

//SORT1   EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//IN1      DD DSN=CHECK.SORT.SUM,DISP=SHR
//OUT1     DD DSN=CHECK.SORT.OUTPUT,DISP=SHR     
//TOOLIN   DD *
  SORT FROM(IN1)  TO(OUT1) USING(CTL1)                   
/*
//CTL1CNTL DD *                                         
   SORT FIELDS=(1,1,CH,A)
   SUM FIELDS=(2,2,BI)                                   
/*
//*                                     

CHECK.SORT.SUM
-----------------

a01
a01
b01
c01
d01
d01
e01
e01
e01
e01
f01

CHEK.SORT.OUTPUT
---------------------

a01
a01
b01
c01
d01
d01
e01
e01
e01
e01
f01
Cheers,
Gokul
User avatar
gokulNmf
 
Posts: 114
Joined: Sat Mar 28, 2009 6:41 pm
Location: India
Has thanked: 0 time
Been thanked: 0 time

Re: DFsort Summing !!

 

Re: DFsort Summing !!

Postby Frank Yaeger » Wed Jul 15, 2009 9:46 pm

I guess you didn't notice the following message:

ICE152I 0 OVERFLOW DURING SUMMATION - RC=0

Since you are using SUM FIELDS=(2,2,BI), DFSORT treats positions 2-3 as binary. So when you try to sum X'F0F1' with X'F0F1', you get an overflow and the records are not summed.

a01 would be a 1 character field followed by a 2-byte ZD field, not a 2-byte BI field.

If you use

   SUM FIELDS=(2,2,ZD)


the output will be:

a02   
b01   
c01   
d02   
e04   
f01   


which I assume is what you're looking for.
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times

Re: DFsort Summing !!

Postby gokulNmf » Sat Aug 01, 2009 8:58 pm

thanks frank!!
i am sorry, i dint reply then! :oops:
i have another question :?: ..
if they are signed.. how to sum them..
keep situation it as below:
a-01
a+01
b+01
c+01
d+01
d+01
e+01
e+01
e+01
e-01
f+01

.... hw to sum these..
i followed the same way as above :idea: , gave the sort fields including the sign, but the RC was soc07(bad data) :( ..
hw can i solve this? :? :?:
Cheers,
Gokul
User avatar
gokulNmf
 
Posts: 114
Joined: Sat Mar 28, 2009 6:41 pm
Location: India
Has thanked: 0 time
Been thanked: 0 time

Re: DFsort Summing !!

Postby Frank Yaeger » Mon Aug 03, 2009 8:48 pm

-nn and +nn are NOT ZD values so you can't use ZD to sum them. You can use the technique shown in the "Sum a number with a decimal point" Smart DFSORT Trick at:

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

Alternatively, you can use a DFSORT job like this:

//S1   EXEC PGM=SORT                                             
//SYSOUT   DD SYSOUT=*                                           
//SORTIN   DD *                                                 
a-01                                                             
a+01                                                             
b+01                                                             
c+01                                                             
d+01                                                             
d+01                                                             
e+01                                                             
e+01                                                             
e+01                                                             
e-01                                                             
f+01
/*                                                             
//SORTOUT  DD SYSOUT=*                                           
//SYSIN    DD *                                                 
   SORT FIELDS=(1,1,CH,A)                                       
   OUTFIL REMOVECC,NODETAIL,                                     
     SECTIONS=(1,1,                                             
       TRAILER3=(1,1,TOT=(2,3,FS,EDIT=(STT),SIGNS=(+,-))))       
/*
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
User avatar
Frank Yaeger
Global moderator
 
Posts: 1080
Joined: Sat Jun 09, 2007 8:44 pm
Has thanked: 0 time
Been thanked: 14 times

Re: DFsort Summing !!

Postby gokulNmf » Tue Aug 04, 2009 8:45 am

Thanks Frank!! :)
Cheers,
Gokul
User avatar
gokulNmf
 
Posts: 114
Joined: Sat Mar 28, 2009 6:41 pm
Location: India
Has thanked: 0 time
Been thanked: 0 time


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post