Page 1 of 1

SUM can't group variable with the same value

PostPosted: Tue Nov 06, 2012 11:20 pm
by tivrfoa
Hi friends,

I don't understand why "COMP" does not group. :(
Please, help me.

//*-------------------------------------------------------------------*
//SORT4     EXEC PGM=SORT
//*
//SYSOUT    DD SYSOUT=*
//*
//SORTIN    DD DSN=DST.BOOK.STORE.SS000111,DISP=SHR
//*
//SORTOUT   DD DSN=DST.BOOK.SUM3.SS000111,DISP=(NEW,CATLG),
//          DSORG=PS,AVGREC=K,
//          SPACE=(080,(100,100),RLSE)
//*
//SYSIN     DD *
   SORT FIELDS=(1,4,CH,A)
   SUM FIELDS=(7,4,ZD)
/*


SORTIN FILE:
0295
9900
BIOL 2350
BUSIN 2350
BUSIN 1925
COMP 3195
COMP 0360
COMP 1899
COMP 2199
COMP 2600
ENGL 1520
ENGL 0625
ENGL 0450
ENGL 1450
ENGL 0595

SORTOUT FILE:
0295
9900
BIOL 2350
BUSIN 4275
COMP 7653
COMP 2600
ENGL 4640

Re: SUM can't group variable with the same value

PostPosted: Tue Nov 06, 2012 11:58 pm
by Pandora-Box
The issue is since sum of comp is greater than 10000 7,4 in sum couldnt accomodate to one record

Re: SUM can't group variable with the same value

PostPosted: Wed Nov 07, 2012 1:11 am
by BillyBoyo
Pandora-Box is correct. Did you get an ICE152I message in your sysout and a non-zero return-code?

Re: SUM can't group variable with the same value

PostPosted: Wed Nov 07, 2012 5:00 pm
by tivrfoa
Pandora-Box wrote:The issue is since sum of comp is greater than 10000 7,4 in sum couldnt accomodate to one record

Thanks a lot Pandora-Box. :D

So it was as "Sum Overflow". IBM's DFSORT tutorial explains how to avoid this:
http://publib.boulder.ibm.com/infocente ... ca5075.htm

So I needed to add 1 to the length and I used INREC to do this:
//SYSIN     DD *
   INREC FIELDS=(1,6,Z,7,4)
   SORT FIELDS=(1,4,CH,A)
   SUM FIELDS=(7,5,ZD)
/*


Is this the best way to avoid this to happen?

Re: SUM can't group variable with the same value

PostPosted: Wed Nov 07, 2012 5:02 pm
by tivrfoa
BillyBoyo wrote:Pandora-Box is correct. Did you get an ICE152I message in your sysout and a non-zero return-code?

Hi Billy,
I didn't find ICE1521 ...
RC = 00, and it shows the message "WER049I SUM FIELD OVERFLOW"

Re: SUM can't group variable with the same value

PostPosted: Wed Nov 07, 2012 5:05 pm
by enrico-sorichetti
WER049I SUM FIELD OVERFLOW


the message tells that You are not using DFSORT but SYNCSORT

the topic should be moved to the SYNCSORT section :geek:

Re: SUM can't group variable with the same value

PostPosted: Wed Nov 07, 2012 5:16 pm
by BillyBoyo
OK. You need to get hold of SyncSort documentation. Not so much for this, but for the next thing you need.

Yes, that is the best way to do it - ensure that you understand what the Z is doing and how that helps you. On occasion you may need "even more space", so ensure that you are happy about how to extend a field by any number of positions, and when the field being extended is not the last.