Index: trunk/ippScripts/scripts/ipp_serial_mops.pl
===================================================================
--- trunk/ippScripts/scripts/ipp_serial_mops.pl	(revision 18536)
+++ trunk/ippScripts/scripts/ipp_serial_mops.pl	(revision 19716)
@@ -31,4 +31,5 @@
      $outroot,                  # Output directory
      $fileset,                  # File set
+     $label,                    # Data label to search for
      $verbose,                  # Verbose output?
      $no_update,                # Don't update state?
@@ -45,4 +46,5 @@
            'outroot=s'  => \$outroot,
            'fileset=s'  => \$fileset,
+           'label=s'    => \$label,
            'verbose'    => \$verbose,
            'no-update'  => \$no_update, # Don't update the database?
@@ -69,5 +71,7 @@
     die "Unable to connect to database: $DBI::errstr";
 
-my $sql = "SELECT exp_id, diff_id, skycell_id, warp_id, diffSkyfile.path_base AS diff_path_base, warpSkyfile.path_base AS warp_path_base FROM diffSkyfile JOIN diffRun using(diff_id) JOIN diffInputSkyfile USING(diff_id,tess_id,skycell_id) JOIN warpRun USING(warp_id,tess_id) JOIN warpSkyfile USING(warp_id,skycell_id,tess_id) JOIN fakeRun using(fake_id) JOIN camRun USING(cam_id) JOIN chipRun USING(chip_id) JOIN rawExp USING(exp_id) WHERE diffSkyfile.fault = 0 AND rawExp.camera = \'$camera\';";
+my $sql = "SELECT exp_id, diff_id, skycell_id, warp_id, diffSkyfile.path_base AS diff_path_base, warpSkyfile.path_base AS warp_path_base FROM diffSkyfile JOIN diffRun using(diff_id) JOIN diffInputSkyfile USING(diff_id,tess_id,skycell_id) JOIN warpRun USING(warp_id,tess_id) JOIN warpSkyfile USING(warp_id,skycell_id,tess_id) JOIN fakeRun using(fake_id) JOIN camRun USING(cam_id) JOIN chipRun USING(chip_id) JOIN rawExp USING(exp_id) WHERE diffSkyfile.fault = 0 AND rawExp.camera = \'$camera\'";
+$sql .= " AND diffRun.label = \'$label\'" if defined $label;
+$sql .= ';';
 
 my $rows = $db->selectall_arrayref( $sql, { Slice => {} } ) or die "Unable to execute SQL: $DBI::errstr";
@@ -106,5 +110,5 @@
     }
 
-    # format: filename|filesize|md5sum|filetype|  
+    # format: filename|filesize|md5sum|filetype|
     # note: since we omit filesize and md5sum, dsreg will calculate them
     print $dsFile "${output}|||ipp-mops|\n";
