Index: trunk/ippTools/src/camtool.c
===================================================================
--- trunk/ippTools/src/camtool.c	(revision 13891)
+++ trunk/ippTools/src/camtool.c	(revision 13937)
@@ -184,7 +184,7 @@
     }
 
-    psString recipe = psMetadataLookupStr(&status, config->args, "-set_recipe");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -set_recipe");
+    psString reduction = psMetadataLookupStr(&status, config->args, "-set_reduction");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -set_reduction");
         return false;
     }
@@ -237,5 +237,5 @@
 
     // would could do this "all in the database" if we didn't want the option
-    // of changing the label/recipe/expgroup/dvodb/etc.  So we're pulling the
+    // of changing the label/reduction/expgroup/dvodb/etc.  So we're pulling the
     // data out so we have the option of changing these values or leaving the
     // old values in place (i.e., passing the values through).
@@ -257,5 +257,5 @@
                     workdir     ? workdir   : row->workdir,
                     label       ? label     : row->label,
-                    recipe      ? recipe    : row->recipe,
+                    reduction      ? reduction    : row->reduction,
                     expgroup    ? expgroup  : row->expgroup,
                     dvodb       ? dvodb     : row->dvodb
@@ -617,5 +617,5 @@
         pendingRow->workdir,
         pendingRow->label,
-        pendingRow->recipe,
+        pendingRow->reduction,
         pendingRow->expgroup,
         pendingRow->dvodb,
@@ -628,10 +628,10 @@
         zp_mean,
         zp_stdev,
-	fwhm,
-	fwhm_range,
-	n_stars,
-	n_extended,
-	n_cr,
-	n_astrom,
+        fwhm,
+        fwhm_range,
+        n_stars,
+        n_extended,
+        n_cr,
+        n_astrom,
         path_base,
         code
Index: trunk/ippTools/src/camtoolConfig.c
===================================================================
--- trunk/ippTools/src/camtoolConfig.c	(revision 13891)
+++ trunk/ippTools/src/camtoolConfig.c	(revision 13937)
@@ -96,6 +96,6 @@
     psMetadataAddStr(queueArgs, PS_LIST_TAIL, "-set_label",  0,
             "define label", NULL);
-    psMetadataAddStr(queueArgs, PS_LIST_TAIL, "-set_recipe",  0,
-            "define recipe", NULL);
+    psMetadataAddStr(queueArgs, PS_LIST_TAIL, "-set_reduction",  0,
+            "define reduction class", NULL);
     psMetadataAddStr(queueArgs, PS_LIST_TAIL, "-set_expgroup",  0,
             "define exposure group", NULL);
Index: trunk/ippTools/src/chiptool.c
===================================================================
--- trunk/ippTools/src/chiptool.c	(revision 13891)
+++ trunk/ippTools/src/chiptool.c	(revision 13937)
@@ -173,7 +173,7 @@
     }
 
-    psString recipe = psMetadataLookupStr(&status, config->args, "-set_recipe");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -set_recipe");
+    psString reduction = psMetadataLookupStr(&status, config->args, "-set_reduction");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -set_reduction");
         return false;
     }
@@ -243,5 +243,5 @@
 
         // queue the exp
-        if (!chipQueueExpTag(config, exp_tag, workdir, label, recipe, expgroup, dvodb)) {
+        if (!chipQueueExpTag(config, exp_tag, workdir, label, reduction, expgroup, dvodb)) {
             if (!psDBRollback(config->dbh)) {
                 psError(PS_ERR_UNKNOWN, false, "database error");
@@ -804,5 +804,5 @@
                     processedExp->workdir,
                     processedExp->label,
-                    processedExp->recipe,
+                    processedExp->reduction,
                     processedExp->expgroup,
                     processedExp->dvodb
@@ -999,5 +999,5 @@
         pendingExp->workdir,
         pendingExp->label,
-        pendingExp->recipe,
+        pendingExp->reduction,
         pendingExp->expgroup,
         pendingExp->dvodb
Index: trunk/ippTools/src/chiptoolConfig.c
===================================================================
--- trunk/ippTools/src/chiptoolConfig.c	(revision 13891)
+++ trunk/ippTools/src/chiptoolConfig.c	(revision 13937)
@@ -94,6 +94,6 @@
     psMetadataAddStr(queueArgs, PS_LIST_TAIL, "-set_label",  0,
             "define label", NULL);
-    psMetadataAddStr(queueArgs, PS_LIST_TAIL, "-set_recipe",  0,
-            "define recipe", NULL);
+    psMetadataAddStr(queueArgs, PS_LIST_TAIL, "-set_reduction",  0,
+            "define reduction class", NULL);
     psMetadataAddStr(queueArgs, PS_LIST_TAIL, "-set_expgroup",  0,
             "define exposure group", NULL);
@@ -115,5 +115,5 @@
             "search by camera of interest", NULL);
     psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-filter",  0,
-            "search by filter of interest", NULL); 
+            "search by filter of interest", NULL);
     psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-uri",  0,
             "search by URL", NULL);
@@ -122,5 +122,5 @@
     psMetadataAddBool(pendingimfileArgs, PS_LIST_TAIL, "-simple",  0,
             "use the simple output format", false);
- 
+
     // -addprocessedimfile
     psMetadata *addprocessedimfileArgs = psMetadataAlloc();
@@ -188,5 +188,5 @@
             "define camera of interest", NULL);
     psMetadataAddStr(processedimfileArgs, PS_LIST_TAIL, "-filter",  0,
-            "define filter of interest", NULL); 
+            "define filter of interest", NULL);
     psMetadataAddStr(processedimfileArgs, PS_LIST_TAIL, "-uri",  0,
             "define URL", NULL);
@@ -226,10 +226,10 @@
     psMetadataAddStr(blockArgs, PS_LIST_TAIL, "-label",  0,
             "name of a label to mask out (required)", NULL);
-    
+
     // -masked
     psMetadata *maskedArgs = psMetadataAlloc();
     psMetadataAddBool(maskedArgs, PS_LIST_TAIL, "-simple",  0,
             "use the simple output format", false);
-    
+
     // -unblock
     psMetadata *unblockArgs = psMetadataAlloc();
Index: trunk/ippTools/src/dettool.c
===================================================================
--- trunk/ippTools/src/dettool.c	(revision 13891)
+++ trunk/ippTools/src/dettool.c	(revision 13937)
@@ -449,4 +449,10 @@
     }
 
+    psString reduction = psMetadataLookupStr(&status, config->args, "-reduction");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -reduction");
+        return false;
+    }
+
     psString label = psMetadataLookupStr(&status, config->args, "-label");
     if (!status) {
@@ -528,32 +534,33 @@
     // XXX det_id
     detRunInsert(config->dbh,
-            0,
-            0,
-            det_type,
-            mode,
-            "run",
-            filelevel,
-            workdir,
-            camera,
-            telescope,
-            exp_type,
-            filter,
-            airmass_min,
-            airmass_max,
-            exp_time_min,
-            exp_time_max,
-            ccd_temp_min,
-            ccd_temp_max,
-            posang_min,
-            posang_max,
-            registered,
-            time_begin,
-            time_end,
-            use_begin,
-            use_end,
-	    solang_min,
-            solang_max,
-            label,
-            0       // parent
+                 0,
+                 0,
+                 det_type,
+                 mode,
+                 "run",
+                 filelevel,
+                 workdir,
+                 camera,
+                 telescope,
+                 exp_type,
+                 reduction,
+                 filter,
+                 airmass_min,
+                 airmass_max,
+                 exp_time_min,
+                 exp_time_max,
+                 ccd_temp_min,
+                 ccd_temp_max,
+                 posang_min,
+                 posang_max,
+                 registered,
+                 time_begin,
+                 time_end,
+                 use_begin,
+                 use_end,
+                 solang_min,
+                 solang_max,
+                 label,
+                 0       // parent
         );
     psFree(registered);
@@ -1172,4 +1179,10 @@
     }
 
+    psString reduction = psMetadataLookupStr(&status, config->args, "-reduction");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -reduction");
+        return false;
+    }
+
     psString label = psMetadataLookupStr(&status, config->args, "-label");
     if (!status) {
@@ -1251,32 +1264,33 @@
     // XXX det_id
     detRunInsert(config->dbh,
-            0,      // det_id
-            0,      // iteration
-            det_type,
-            mode,
-            "run",  // state
-            filelevel,
-            workdir,
-            camera,
-            telescope,
-            "NA",
-            filter,
-            airmass_min,
-            airmass_max,
-            exp_time_min,
-            exp_time_max,
-            ccd_temp_min,
-            ccd_temp_max,
-            posang_min,
-            posang_max,
-            registered,
-            time_begin,
-            time_end,
-            use_begin,
-            use_end,
-	    solang_min,
-            solang_max,
-            label,
-            0       // parent
+                 0,      // det_id
+                 0,      // iteration
+                 det_type,
+                 mode,
+                 "run",  // state
+                 filelevel,
+                 workdir,
+                 camera,
+                 telescope,
+                 "NA",
+                 reduction,
+                 filter,
+                 airmass_min,
+                 airmass_max,
+                 exp_time_min,
+                 exp_time_max,
+                 ccd_temp_min,
+                 ccd_temp_max,
+                 posang_min,
+                 posang_max,
+                 registered,
+                 time_begin,
+                 time_end,
+                 use_begin,
+                 use_end,
+                 solang_min,
+                 solang_max,
+                 label,
+                 0       // parent
         );
     psFree(registered);
@@ -1671,4 +1685,14 @@
             psFree(use_end);
         }
+    }
+
+    psString reduction = psMetadataLookupStr(&status, config->args, "-set_reduction");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -set_reduction");
+        return false;
+    }
+    if (reduction) {
+        psFree(detRun->reduction);
+        detRun->reduction = psStringCopy(reduction);
     }
 
@@ -2115,4 +2139,5 @@
             "   detRun.det_type,"
             "   detRun.workdir,"
+            "   detRun.reduction,"
             "   rawImfile.*,"
             "   rawExp.camera"
@@ -2862,4 +2887,5 @@
         "    detRun.det_type,\n"
         "    detRun.workdir,\n"
+        "    detRun.reduction,\n"
         "    detProcessedImfile.class_id,\n"
         "    rawExp.camera\n"
@@ -2987,12 +3013,12 @@
     // add the two required restrictions: detRun.state and detRun.mode
     if ((value = psMetadataLookupStr(&status, config->args, "-select_state"))) {
-	psStringAppend(&query, " detRun.state = '%s'", value);
+        psStringAppend(&query, " detRun.state = '%s'", value);
     } else {
-	psStringAppend(&query, " detRun.state = 'run'");
+        psStringAppend(&query, " detRun.state = 'run'");
     }
     if ((value = psMetadataLookupStr(&status, config->args, "-select_mode"))) {
-	psStringAppend(&query, " AND detRun.mode = '%s'", value);
+        psStringAppend(&query, " AND detRun.mode = '%s'", value);
     } else {
-	psStringAppend(&query, " AND detRun.mode = 'master'");
+        psStringAppend(&query, " AND detRun.mode = 'master'");
     }
 
@@ -4407,4 +4433,5 @@
         "   detRun.mode,\n"
         "   detRun.workdir,\n"
+        "   detRun.reduction,\n"
         "   detProcessedImfile.exp_tag,\n"
         "   detProcessedImfile.class_id,\n"
@@ -4444,4 +4471,5 @@
         "   detRun.mode,\n"
         "   detRun.workdir,\n"
+        "   detRun.reduction,\n"
         "   rawImfile.exp_tag,\n"
         "   rawImfile.class_id,\n"
@@ -6774,33 +6802,34 @@
 
     if (!detRunInsert(config->dbh,
-            0,          // det_id
-            0,          // the iteration is fixed at 0
-            det_type,
-            mode,
-            "reg",      // state
-            filelevel,
-            workdir,
-            camera,
-            telescope,
-            exp_type,
-            filter,
-            airmass_min,
-            airmass_max,
-            exp_time_min,
-            exp_time_max,
-            ccd_temp_min,
-            ccd_temp_max,
-            posang_min,
-            posang_max,
-            registered,
-            time_begin,
-            time_end,
-            use_begin,
-            use_end,
-            solang_min,
-            solang_max,
-            label,      // label
-            parent ? (psS64)atoll(parent) : 0
-    )) {
+                      0,          // det_id
+                      0,          // the iteration is fixed at 0
+                      det_type,
+                      mode,
+                      "reg",      // state
+                      filelevel,
+                      workdir,
+                      camera,
+                      telescope,
+                      exp_type,
+                      NULL,
+                      filter,
+                      airmass_min,
+                      airmass_max,
+                      exp_time_min,
+                      exp_time_max,
+                      ccd_temp_min,
+                      ccd_temp_max,
+                      posang_min,
+                      posang_max,
+                      registered,
+                      time_begin,
+                      time_end,
+                      use_begin,
+                      use_end,
+                      solang_min,
+                      solang_max,
+                      label,      // label
+                      parent ? (psS64)atoll(parent) : 0
+            )) {
         psError(PS_ERR_UNKNOWN, false, "database error");
         // rollback
Index: trunk/ippTools/src/dettoolConfig.c
===================================================================
--- trunk/ippTools/src/dettoolConfig.c	(revision 13891)
+++ trunk/ippTools/src/dettoolConfig.c	(revision 13937)
@@ -115,4 +115,6 @@
     psMetadataAddStr(definebytagArgs, PS_LIST_TAIL, "-use_end",  0,
             "end of detrend run applicable peroid", NULL);
+    psMetadataAddStr(definebytagArgs, PS_LIST_TAIL, "-reduction",  0,
+            "define reduction class for processing", NULL);
     psMetadataAddStr(definebytagArgs, PS_LIST_TAIL, "-label",  0,
             "define detrun label", NULL);
@@ -204,4 +206,6 @@
     psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-pretend",  0,
             "print the exposures that would be included in the detrend run and exit", false);
+    psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-reduction",  0,
+            "define reduction class for processing", NULL);
     psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-label",  0,
             "define detrun label", NULL);
@@ -259,4 +263,6 @@
     psMetadataAddStr(definebydetrunArgs, PS_LIST_TAIL, "-filter_input_end", 0,
             "filter input detrun exp to be in this peroid", NULL);
+    psMetadataAddStr(definebydetrunArgs, PS_LIST_TAIL, "-set_reduction",  0,
+            "define reduction class for processing", NULL);
     psMetadataAddStr(definebydetrunArgs, PS_LIST_TAIL, "-set_label",  0,
             "define detrun label", NULL);
