Index: trunk/tools/eam/rawfix.20230221/src/check_chip_locations.pl
===================================================================
--- trunk/tools/eam/rawfix.20230221/src/check_chip_locations.pl	(revision 42450)
+++ trunk/tools/eam/rawfix.20230221/src/check_chip_locations.pl	(revision 42451)
@@ -55,5 +55,5 @@
     open ($outfh, ">$topdir/$dateword/$chip_id.uris.$stage.txt");
 
-    print "open $topdir/$dateword/$chip_id.uris.$stage.txt\n";
+    # print "open $topdir/$dateword/$chip_id.uris.$stage.txt\n";
 
     # get the list of chip neb paths for one chip
Index: trunk/tools/eam/rawfix.20230221/src/create.rawfix.sh
===================================================================
--- trunk/tools/eam/rawfix.20230221/src/create.rawfix.sh	(revision 42450)
+++ trunk/tools/eam/rawfix.20230221/src/create.rawfix.sh	(revision 42451)
@@ -6,4 +6,13 @@
 
 # add in the iteration and the state summary
+
+mysql -h localhost -u root <<EOF
+  use $DBNAME;
+  ALTER TABLE nights MODIFY Ngood INT, MODIFY Ndead INT, MODIFY Ngone INT;
+  ALTER TABLE nights MODIFY Nsing INT, MODIFY Ndups INT, MODIFY Nsbck INT, MODIFY Nxbck INT, MODIFY Nfail INT;
+  ALTER TABLE nights MODIFY Ncul1 INT, MODIFY Ncul2 INT, MODIFY Ncul3 INT;
+EOF
+
+exit 0
 
 mysql -h localhost -u root <<EOF
Index: trunk/tools/eam/rawfix.20230221/src/fix_chip_locations.pl
===================================================================
--- trunk/tools/eam/rawfix.20230221/src/fix_chip_locations.pl	(revision 42450)
+++ trunk/tools/eam/rawfix.20230221/src/fix_chip_locations.pl	(revision 42451)
@@ -145,5 +145,5 @@
 	    my ($newfile, $newhost, $newxattr) = &get_new_instance ($ext_id);
 	    unless ($newxattr == 1) { die "new instance is not at ATRC? $ext_id : $newfile : $newhost : $newxattr\n"; }
-	    open (OUTFILE, ">>$topdir/$dateword/$newhost.inst.$stage.txt");
+	    open (OUTFILE, ">>$topdir/$dateword/$newhost.$chip_id.inst.$stage.txt");
 	    print OUTFILE "$newfile $datast $md5sum\n";
 	    close (OUTFILE);
@@ -160,5 +160,5 @@
 	    my ($newfile, $newhost, $newxattr) = &get_new_instance ($ext_id);
 	    unless ($newxattr == 0) { die "new instance is not at ITC? $ext_id : $newfile : $newhost : $newxattr\n"; }
-	    open (OUTFILE, ">>$topdir/$dateword/$newhost.inst.$stage.txt");
+	    open (OUTFILE, ">>$topdir/$dateword/$newhost.$chip_id.inst.$stage.txt");
 	    print OUTFILE "$newfile $datast $md5sum\n";
 	    close (OUTFILE);
@@ -175,5 +175,5 @@
 		my ($newfile, $newhost, $newxattr) = &get_new_instance ($ext_id);
 		unless ($newxattr == 1) { die "new instance is not at ATRC? $ext_id : $newfile : $newhost : $newxattr\n"; }
-		open (OUTFILE, ">>$topdir/$dateword/$newhost.inst.$stage.txt");
+		open (OUTFILE, ">>$topdir/$dateword/$newhost.$chip_id.inst.$stage.txt");
 		print OUTFILE "$newfile $datast $md5sum\n";
 		close (OUTFILE);
@@ -197,5 +197,5 @@
 		my ($newfile, $newhost, $newxattr) = &get_new_instance ($ext_id);
 		unless ($newxattr == 0) { die "new instance is not at ITC? $ext_id : $newfile : $newhost : $newxattr\n"; }
-		open (OUTFILE, ">>$topdir/$dateword/$newhost.inst.$stage.txt");
+		open (OUTFILE, ">>$topdir/$dateword/$newhost.$chip_id.inst.$stage.txt");
 		print OUTFILE "$newfile $datast $md5sum\n";
 		close (OUTFILE);
Index: trunk/tools/eam/rawfix.20230221/src/get_md5s_instances.pl
===================================================================
--- trunk/tools/eam/rawfix.20230221/src/get_md5s_instances.pl	(revision 42450)
+++ trunk/tools/eam/rawfix.20230221/src/get_md5s_instances.pl	(revision 42451)
@@ -13,5 +13,6 @@
 # USAGE: get_md5s_instances.pl --hostname (hostname) --input (file) --stage (0,1,etc)
 
-my ($myhost, $input, $stage) = &parse_cmdopts;
+my $input;
+my ($myhost, $dateword, $topdir, $stage) = &parse_cmdopts;
 
 # check that we are running this script on 'myhost'
@@ -20,12 +21,9 @@
 
 # read the list of instances:
-my ($ins_list_r, $dst_list_r, $md5_list_r) = &load_instance_list ($input);
+my ($ins_list_r, $dst_list_r, $md5_list_r) = &load_instance_list ();
 
-my $output = $input;
-$output =~ s/inst.$stage/md5s/;
+my $output = "$topdir/$dateword/$myhost.md5s.txt";
 
-if ($output eq $input) { die "output file ($output) matches input file ($input)\n"; }
-
-# read in both instance
+# read in existing md5s
 my $out_hash_r;
 if (-e $output) {
@@ -60,10 +58,5 @@
     }
 
-    my $line;
-    if (0) {
-	$line = "fakevalue $filename"; # XXX TEST: disable calculation:
-    } else {
-	$line = `md5sum $filename`;
-    }
+    my $line = `md5sum $filename`;
 
     my ($md5sum, $rawfile) = split (" ", $line);
@@ -73,9 +66,26 @@
 exit 0;
 
+# use global $topdir, $dateword, $myhost, $stage
+sub load_instance_list {
+    my (@ins_list, @dst_list, @md5_list);
+
+    # load the master list
+    my $input = "$topdir/$dateword/$myhost.inst.$stage.txt";
+    &load_instance_list_onefile ($input, \@ins_list, \@dst_list, \@md5_list);
+
+    # there may be additional instances in files with names like HOSTNAME.XYnn.inst.STAGE 
+    my @instlist = glob ("$topdir/$dateword/$myhost.XY??.inst.$stage.txt");
+    foreach my $infile  (@instlist) {
+	&load_instance_list_onefile ($infile, \@ins_list, \@dst_list, \@md5_list);
+    }
+    return (\@ins_list, \@dst_list, \@md5_list);
+}
+
 # read the instance info
-sub load_instance_list {
+sub load_instance_list_onefile {
     my $infile = $_[0];
-
-    my (@ins_list, @dst_list, @md5_list);
+    my $ins_list_r = $_[1]; # reference to the instance list array
+    my $dst_list_r = $_[2]; # reference to the instance list array
+    my $md5_list_r = $_[3]; # reference to the instance list array
 
     open(FILE,$infile) or die "cannot open file $infile\n"; 
@@ -89,11 +99,9 @@
 
 	if (@words != 3) { die "error in input $infile : $line\n"; }
-	push (@ins_list, $words[0]);
-	push (@dst_list, $words[1]);
-	push (@md5_list, $words[2]);
+	push (@$ins_list_r, $words[0]);
+	push (@$dst_list_r, $words[1]);
+	push (@$md5_list_r, $words[2]);
     }
     close (FILE);
-
-    return (\@ins_list, \@dst_list, \@md5_list);
 }
 
@@ -123,10 +131,12 @@
 sub parse_cmdopts {
 
-    my ($myhost, $input, $stage);
-    GetOptions( 'hostname=s' => \$myhost, 'input=s' => \$input, 'stage=s' => \$stage) || pod2usage(2);
+    my ($myhost, $topdir, $dateobs, $stage);
+    GetOptions( 'hostname=s' => \$myhost, 'topdir=s' => \$topdir, 'dateobs=s' => \$dateobs, 'stage=s' => \$stage) || pod2usage(2);
     
-    pod2usage( -msg => "Provide the input list with --input", -exitval => 2) unless defined $input;
+    pod2usage( -msg => "Cannot determine target date, use --dateobs YYYYMMDD", -exitval => 2) unless defined $dateobs;
+#   pod2usage( -msg => "Provide the input list with --input", -exitval => 2) unless defined $input;
     pod2usage( -msg => "Define the host machine with --hostname", -exitval => 2) unless defined $myhost;
     pod2usage( -msg => "Define the stage (0, 1, etc) with --stage", -exitval => 2) unless defined $stage;
+    pod2usage( -msg => "Specify the top-level output directory with --topdir", -exitval => 2) unless defined $topdir;
     
     # check that stage is an integer
@@ -134,5 +144,5 @@
     unless ($stage >= 0) { die "stage must be a non-negative integer\n"; }
     
-    return ($myhost, $input, $stage);
+    return ($myhost, $dateobs, $topdir, $stage);
 }
 
Index: trunk/tools/eam/rawfix.20230221/src/rawfix.fixchip.pt
===================================================================
--- trunk/tools/eam/rawfix.20230221/src/rawfix.fixchip.pt	(revision 42450)
+++ trunk/tools/eam/rawfix.20230221/src/rawfix.fixchip.pt	(revision 42451)
@@ -149,6 +149,6 @@
     option $pageName $DATEOBS
 
-    stdout $pageName/log.fixchip.run.v$ITER
-    stderr $pageName/log.fixchip.run.v$ITER
+    stdout $DATEOBS/log.fixchip.run.$CHIP_ID.v$ITER
+    stderr $DATEOBS/log.fixchip.run.$CHIP_ID.v$ITER
 
     substr $DATEOBS 0 4 YEAR
Index: trunk/tools/eam/rawfix.20230221/src/rawfix.md5sum.pt
===================================================================
--- trunk/tools/eam/rawfix.20230221/src/rawfix.md5sum.pt	(revision 42450)
+++ trunk/tools/eam/rawfix.20230221/src/rawfix.md5sum.pt	(revision 42451)
@@ -177,5 +177,6 @@
     # if we are able to run the 'exec', use a short retry time to launch all outstanding jobs
     periods -exec 0.05
-    command $mypath/get_md5s_instances.pl --hostname $USE_HOST --input $input --stage $ITER
+    command $mypath/get_md5s_instances.pl --hostname $USE_HOST --topdir $mypath --dateobs $DATEOBS --stage $ITER
+#   command $mypath/get_md5s_instances.pl --hostname $USE_HOST --input $input --stage $ITER
   end
 
Index: trunk/tools/eam/rawfix.20230221/src/rawfix.pt
===================================================================
--- trunk/tools/eam/rawfix.20230221/src/rawfix.pt	(revision 42450)
+++ trunk/tools/eam/rawfix.20230221/src/rawfix.pt	(revision 42451)
@@ -19,6 +19,6 @@
 # required host
 
-$HOST_CKCHIP  = ipp060
-$HOST_FIXCHIP = ipp070
+# run check_chip_locations.pl on this machine:
+$HOST_CKCHIP  = ippc180
 
 if (not($?LOGDIR)) 
@@ -38,5 +38,4 @@
 if (not($?INIT_RAWFIX)) 
   control host add $HOST_CKCHIP
-  control host add $HOST_FIXCHIP
   $INIT_RAWFIX = 1
 end
