Page 1 of 1

Problem with XSUM and Syncsort

PostPosted: Thu Sep 25, 2008 10:22 pm
by arla
First post, so be gentle :)

I'm having a problem with using XSUM in a sort routine, until today (at least a year) this sort has worked just perfectly, and then today seemed to start giving "random" results as to which record it was eliminating.

Essentially the Key to my file is a 16 character field at position 26

I'm sorting two files together using this

//*-------------------------------------------------------------------
//* NOW SORT THE ACH INTO IT                                         
//*-------------------------------------------------------------------
//S020     EXEC PGM=SORT                                             
//SORTWK01 DD SPACE=(CYL,1000)                                       
//SYSPRINT DD SYSOUT=*                                               
//SYSOUT   DD SYSOUT=*                                               
//$ORTPARM DD DISP=SHR,DSN=TCTAA.CNVTKIT.SYSIN(GIN1001A)             
//SORTIN   DD DISP=SHR,DSN=KCTAA.COC.BKP.CPOL.OUTPUT(0)                             
//         DD DISP=SHR,DSN=TCTAA.COC.ACHTEST                         
//SORTOUT  DD DISP=(NEW,CATLG),DSN=TCTAA.TKIT.J129S010.CNC300S(+1),   
//         SPACE=(CYL,(10,10),RLSE),                                 
//         VOL=(,,,40)                                               
//SYSIN    DD *                                                       
  SORT FIELDS=(26,16,CH,A,                                             
               42,4,CH,A,                                             
               46,4,CH,A,                                             
               19,4,CH,A,                                             
               69,5,CH,A,                                             
               50,4,CH,A)                                             


As you can see, it sorts with the various sort fields, this always ends up with the record I am interested in is first, and the record I want elimited as a duplicate is second (verified repeatedly in file output)

For the XSUM part I'm using
//*-------------------------------------------------------------------
//* NOW SORT THAT ELIMINATING DUPLICATES (BASED ON POLICY NUMBER)     
//*-------------------------------------------------------------------
//S030     EXEC PGM=SORT                                             
//SORTWK01 DD SPACE=(CYL,1000)                                       
//SYSPRINT DD SYSOUT=*                                               
//SYSOUT   DD SYSOUT=*                                               
//$ORTPARM DD DISP=SHR,DSN=TCTAA.CNVTKIT.SYSIN(GIN1001A)             
//SORTIN   DD DISP=SHR,DSN=*.S020.SORTOUT                             
//SORTOUT  DD DISP=(NEW,CATLG),DSN=TCTAA.TKIT.J129S010.CNC300S(+2),   
//         SPACE=(CYL,(10,10),RLSE),                                 
//         VOL=(,,,40)                                               
//SORTXSUM DD DISP=(NEW,CATLG),DSN=TCTAA.TKIT.J129S010.CNC300S(+3),   
//         SPACE=(CYL,(10,10),RLSE),                                 
//         VOL=(,,,40)                                               
//SYSIN    DD *                                                       
  SUM FIELDS=NONE,XSUM                                                 
  SORT FIELDS=(26,16,CH,A)                                             
//*-------------------------------------------------------------------


Which I believe should always eliminate the second record, and yet, sometimes it's eliminating the first record?

Anyone have any ideas?

Re: Problem with XSUM and Syncsort

PostPosted: Fri Sep 26, 2008 2:44 am
by dick scherrer
Hello Arla and welcome to the forums,

Anyone have any ideas?
My guess is that it is not now deleting the "first". What is happening is that records do not always sort into "first" and "second", so when the order changes, the "other" record gets deleted.

If you include EQUALS, this will keep the records within a sort key in the "same" order, so the first record remains the first record :)

Re: Problem with XSUM and Syncsort

PostPosted: Fri Sep 26, 2008 3:45 am
by arla
Okay, that seems to work, thanks a bunch, my $ORTPARM was
  DYNALLOC=(SYSDA,16)
  CORE=MAX           


Followup question though, any idea why my code might have worked just fine for the last year or so, just luck of the draw?

Re: Problem with XSUM and Syncsort

PostPosted: Fri Sep 26, 2008 5:04 am
by dick scherrer
Hello,

any idea why my code might have worked just fine for the last year or so,
What is the chance that the first 2 became shuffled and not caught somewhere along the line?

just luck of the draw?
Possibly. That or something in the process caused the difference in how the records were manipulated. As IBM said about many things. . . "The results may be unpredictable" :)

You can put the EQUALS in the sort control info if you don't already have/don't want a $ORTPARM. I believe it may be set as a site option also (not positive on that). I check with the system programmer who supports Syncsort on your system.