Index: trunk/ippTools/src/camtool.c
===================================================================
--- trunk/ippTools/src/camtool.c	(revision 25330)
+++ trunk/ippTools/src/camtool.c	(revision 25835)
@@ -121,4 +121,6 @@
     PXOPT_LOOKUP_STR(workdir, config->args, "-set_workdir", false, false);
     PXOPT_LOOKUP_STR(label, config->args, "-set_label", false, false);
+    PXOPT_LOOKUP_STR(data_group, config->args, "-set_data_group", false, false);
+    PXOPT_LOOKUP_STR(dist_group, config->args, "-set_dist_group", false, false);
     PXOPT_LOOKUP_STR(reduction, config->args, "-set_reduction", false, false);
     PXOPT_LOOKUP_STR(expgroup, config->args, "-set_expgroup", false, false);
@@ -126,4 +128,5 @@
     PXOPT_LOOKUP_STR(tess_id, config->args, "-set_tess_id", false, false);
     PXOPT_LOOKUP_STR(end_stage, config->args, "-set_end_stage", false, false);
+    PXOPT_LOOKUP_STR(note, config->args, "-set_note", false, false);
 
     // find the exp_id of all the exposures that we want to queue up.
@@ -212,9 +215,12 @@
                     workdir     ? workdir   : row->workdir,
                     label       ? label     : row->label,
+                    data_group  ? data_group: row->data_group,
+                    dist_group  ? dist_group: row->dist_group,
                     reduction   ? reduction : row->reduction,
                     expgroup    ? expgroup  : row->expgroup,
                     dvodb       ? dvodb     : row->dvodb,
                     tess_id     ? tess_id   : row->tess_id,
-                    end_stage   ? end_stage : row->end_stage
+                    end_stage   ? end_stage : row->end_stage,
+                    note
         )) {
             if (!psDBRollback(config->dbh)) {
@@ -251,39 +257,21 @@
     PXOPT_COPY_STR(config->args, where, "-reduction", "camRun.reduction", "==");
 
-    if (!psListLength(where->list)
-        && !psMetadataLookupBool(NULL, config->args, "-all")) {
+    if (!psListLength(where->list)) {
         psFree(where);
         psError(PXTOOLS_ERR_DATA, false, "search parameters are required");
         return false;
     }
-
-    PXOPT_LOOKUP_STR(state, config->args, "-set_state", false, false);
-    PXOPT_LOOKUP_STR(label, config->args, "-set_label", false, false);
-
-    if ((!state) && (!label)) {
-        psError(PXTOOLS_ERR_DATA, false, "parameters are required");
-        psFree(where);
-        return false;
-    }
-
-    if (state) {
-        // set camRun.state to state
-        if (!pxcamRunSetStateByQuery(config, where, state)) {
-            psFree(where);
-            return false;
-        }
-    }
-
-    if (label) {
-        // set camRun.label to label
-        if (!pxcamRunSetLabelByQuery(config, where, label)) {
-            psFree(where);
-            return false;
-        }
-    }
-
+    psString query = psStringCopy("UPDATE camRun JOIN chipRun USING(chip_id) JOIN rawExp USING(exp_id)");
+
+    // pxUpdateRun gets parameters from config->args and updates
+    bool result = pxUpdateRun(config, where, &query, true);
+    if (!result) {
+        psError(PXTOOLS_ERR_DATA, false, "pxUpdateRun failed");
+    }
+
+    psFree(query);
     psFree(where);
 
-    return true;
+    return result;
 }
 
@@ -642,9 +630,12 @@
             pendingRow->workdir,
             pendingRow->label,
+            pendingRow->data_group,
+            pendingRow->dist_group,
             pendingRow->reduction,
             pendingRow->expgroup,
             pendingRow->dvodb,
             pendingRow->tess_id,
-            pendingRow->end_stage
+            pendingRow->end_stage,
+            NULL    // note does not propagate
     )) {
         // rollback
@@ -656,20 +647,4 @@
         return false;
     }
-
-/*     if (!pxaddQueueByCamID(config, */
-/* 			   pendingRow->cam_id, */
-/* 			   pendingRow->workdir, */
-/* 			   pendingRow->label, */
-/* 			   pendingRow->reduction, */
-/* 			   pendingRow->dvodb */
-/*     )) { */
-/*         // rollback */
-/*         if (!psDBRollback(config->dbh)) { */
-/*             psError(PS_ERR_UNKNOWN, false, "database error"); */
-/*         } */
-/*         psError(PS_ERR_UNKNOWN, false, "failed to queue new addRun"); */
-/*         psFree(pendingRow); */
-/*         return false; */
-/*     } */
 
     psFree(pendingRow);
