Index: trunk/ippTools/src/pubtool.c
===================================================================
--- trunk/ippTools/src/pubtool.c	(revision 27071)
+++ trunk/ippTools/src/pubtool.c	(revision 28319)
@@ -157,5 +157,12 @@
     // optional
     PXOPT_COPY_S64(config->args, where, "-client_id", "client_id", "==");
-    pxAddLabelSearchArgs(config, where, "-label", "label", "=="); // define using newExp label
+    pxAddLabelSearchArgs(config, where, "-label", "label", "==");
+    pxAddLabelSearchArgs(config, where, "-data_group", "data_group", "==");
+    PXOPT_COPY_TIME(config->args, where, "-dateobs_begin", "rawExp.dateobs", ">=");
+    PXOPT_COPY_TIME(config->args, where, "-dateobs_end", "rawExp.dateobs", "<=");
+    PXOPT_COPY_STR(config->args, where, "-filter", "rawExp.filter", "LIKE");
+    PXOPT_COPY_STR(config->args, where, "-obs_mode", "rawExp.obs_mode", "LIKE");
+
+    PXOPT_LOOKUP_BOOL(rerun, config->args, "-rerun", false);
 
     psString query = pxDataGet("pubtool_definerun.sql"); // Query to run
@@ -164,4 +171,8 @@
         psFree(where);
         return false;
+    }
+
+    if (!rerun) {
+        psStringAppend(&query, "WHERE publishRun.client_id IS NULL");
     }
 
@@ -241,5 +252,5 @@
     PXOPT_COPY_STR(config->args, where, "-stage", "publishClient.stage", "==");
     PXOPT_COPY_STR(config->args, where, "-comment", "publishClient.comment", "LIKE");
-    PXOPT_COPY_STR(config->args, where, "-label", "publishRun.label", "==");
+    pxAddLabelSearchArgs(config, where, "-label", "label", "==");
 
     // optional
