*** DatasetI.pm.orig	Tue Sep 27 14:08:26 2011
--- DatasetI.pm	Tue Sep 27 14:15:20 2011
***************
*** 1348,1357 ****
  		{
  			my $lastBatchRows = $self->get('rowsFromLastBatch');
  			my $doWriteBack =0;
! 			foreach my $firstkey( keys %$lastBatchRows) {
  				if (exists $this_dset_hash{$firstkey}) ####### only bring into prev_hash if required and delete immediately
  				{	
! 					foreach my $secondkey (keys %{$lastBatchRows->{$firstkey}}) {
  						#$prev_dset_hash{$firstkey}{$secondkey} = $lastBatchRows->{$firstkey}{$secondkey};
  						foreach my $rows (@{$lastBatchRows->{$firstkey}{$secondkey}})
  						{
--- 1348,1357 ----
  		{
  			my $lastBatchRows = $self->get('rowsFromLastBatch');
  			my $doWriteBack =0;
! 			foreach my $firstkey( sort keys %$lastBatchRows) {
  				if (exists $this_dset_hash{$firstkey}) ####### only bring into prev_hash if required and delete immediately
  				{	
! 					foreach my $secondkey (sort keys %{$lastBatchRows->{$firstkey}}) {
  						#$prev_dset_hash{$firstkey}{$secondkey} = $lastBatchRows->{$firstkey}{$secondkey};
  						foreach my $rows (@{$lastBatchRows->{$firstkey}{$secondkey}})
  						{
***************
*** 1368,1377 ****
  		}
  
  		my $saveForNextBatch = undef;
! 		foreach my $firstkey (keys %prev_dset_hash) {
  			if (!exists $this_dset_hash{$firstkey}) {
  				$saveForNextBatch ||= $self->get('rowsFromLastBatch');
! 				foreach my $secondkey (keys %{$prev_dset_hash{$firstkey}}) {
  #					print "<BR>$firstkey : $secondkey";
  #					print "<BR>Already EXISTS :", Dumper($saveForNextBatch) if(exists $saveForNextBatch->{$firstkey}{$secondkey});
  					#$saveForNextBatch->{$firstkey}{$secondkey} = $prev_dset_hash{$firstkey}{$secondkey};
--- 1368,1377 ----
  		}
  
  		my $saveForNextBatch = undef;
! 		foreach my $firstkey (sort keys %prev_dset_hash) {
  			if (!exists $this_dset_hash{$firstkey}) {
  				$saveForNextBatch ||= $self->get('rowsFromLastBatch');
! 				foreach my $secondkey (sort keys %{$prev_dset_hash{$firstkey}}) {
  #					print "<BR>$firstkey : $secondkey";
  #					print "<BR>Already EXISTS :", Dumper($saveForNextBatch) if(exists $saveForNextBatch->{$firstkey}{$secondkey});
  					#$saveForNextBatch->{$firstkey}{$secondkey} = $prev_dset_hash{$firstkey}{$secondkey};
***************
*** 1393,1402 ****
  #	print "<BR>=================== PREV_DATASET ================ <BR>", Dumper(\%prev_dset_hash);
  #	print "<BR>=================== THIS_DATASET ================ <BR>", Dumper(\%this_dset_hash);
  
! 	foreach my $prkey(keys %this_dset_hash)
  	{
  		
! 		foreach my $key(keys %{$this_dset_hash{$prkey}})
  		{
  			my $this_dset_rows = $this_dset_hash{$prkey}{$key};
  			
--- 1393,1402 ----
  #	print "<BR>=================== PREV_DATASET ================ <BR>", Dumper(\%prev_dset_hash);
  #	print "<BR>=================== THIS_DATASET ================ <BR>", Dumper(\%this_dset_hash);
  
! 	foreach my $prkey(sort keys %this_dset_hash)
  	{
  		
! 		foreach my $key(sort keys %{$this_dset_hash{$prkey}})
  		{
  			my $this_dset_rows = $this_dset_hash{$prkey}{$key};
  			
***************
*** 1427,1445 ****
      				my @allRows;
  		    		if (defined $prev_dset_hash{$pKey})
  					{
! 						foreach my $key_string (keys %{$prev_dset_hash{$pKey}}) {
  	    					push @allRows, $prev_dset_hash{$pKey}{$key_string} ;
  		    			}
  		    		}
  		    		if (!@allRows && exists $prev_dset_hash{lc($pKey)})
  		    		{
! 		    			foreach my $key_string (keys %{$prev_dset_hash{lc($pKey)}}) {
  	    					push @allRows, $prev_dset_hash{lc($pKey)}{$key_string} ;
  		    			}
  		    		}
  		    		if (!@allRows && exists $prev_dset_hash{uc($pKey)})
  		    		{
! 		    			foreach my $key_string (keys %{$prev_dset_hash{uc($pKey)}}) {
  	    					push @allRows, $prev_dset_hash{uc($pKey)}{$key_string} ;
  		    			}
  		    		}
--- 1427,1445 ----
      				my @allRows;
  		    		if (defined $prev_dset_hash{$pKey})
  					{
! 						foreach my $key_string (sort keys %{$prev_dset_hash{$pKey}}) {
  	    					push @allRows, $prev_dset_hash{$pKey}{$key_string} ;
  		    			}
  		    		}
  		    		if (!@allRows && exists $prev_dset_hash{lc($pKey)})
  		    		{
! 		    			foreach my $key_string (sort keys %{$prev_dset_hash{lc($pKey)}}) {
  	    					push @allRows, $prev_dset_hash{lc($pKey)}{$key_string} ;
  		    			}
  		    		}
  		    		if (!@allRows && exists $prev_dset_hash{uc($pKey)})
  		    		{
! 		    			foreach my $key_string (sort keys %{$prev_dset_hash{uc($pKey)}}) {
  	    					push @allRows, $prev_dset_hash{uc($pKey)}{$key_string} ;
  		    			}
  		    		}
