Page 2 of 2

Re: Sequence Number Problem

PostPosted: Thu Oct 11, 2012 9:18 pm
by skolusu
Mayank & Bill,

Unless I am thick and my brain isn't working, are you both getting the correct results? I mean shouldn't you be incrementing the seqnum for every 50 records within the key?? Lets say for example you have a key ABC and you have 168 records of ABC. So key 51,101 & 151 should be 2,3,4 . with your code , the first set is 50 and the next sets are 51 ,52... and so on.

Run the following test data as sample with your control cards and check the records 51,101,151,152 .... within each key.

//STEP0050 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD *                                                 
ABC                                                             
DEF                                                             
EFG                                                             
//SORTOUT  DD DSN=&&IN,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)     
//SYSIN    DD *                                                 
  SORT FIELDS=COPY                                             
  OUTFIL REPEAT=168                                             
//*


The following control cards will give you the sequence number with increment for every 50 records within the key. You don't even need IFTHEN. The trick here is to start the seqnum with the value we want to divide with. In this case it is 50. so start the seqnum with 50.
//SYSIN    DD *                                           
  SORT FIELDS=COPY                                       
  INREC OVERLAY=(10:SEQNUM,5,FS,START=50,RESTART=(1,3),   
                 10:10,5,FS,DIV,+50,FS,LENGTH=5)         
//*

Re: Sequence Number Problem

PostPosted: Fri Oct 12, 2012 11:12 am
by Mayank[123]
Thanks Kolusu...