Index: trunk/ippTools/src/dettool.c
===================================================================
--- trunk/ippTools/src/dettool.c	(revision 8459)
+++ trunk/ippTools/src/dettool.c	(revision 8460)
@@ -35,4 +35,5 @@
 static bool addresidexpMode(pxConfig *config);
 static bool residexpMode(pxConfig *config);
+static bool residdetrunMode(pxConfig *config);
 static bool declaremasterframeMode(pxConfig *config);
 static bool masterframeMode(pxConfig *config);
@@ -91,4 +92,5 @@
         MODECASE(DETTOOL_MODE_ADDRESIDEXP,      addresidexpMode);
         MODECASE(DETTOOL_MODE_RESIDEXP,         residexpMode);
+        MODECASE(DETTOOL_MODE_RESIDDETRUN,      residdetrunMode);
         MODECASE(DETTOOL_MODE_DECLAREMASTERFRAME, declaremasterframeMode);
         MODECASE(DETTOOL_MODE_MASTERFRAME,      masterframeMode);
@@ -3178,110 +3180,4 @@
 }
 
-#if 0    
-    PS_ASSERT_PTR_NON_NULL(config, false);
- 
-    // det_id, exp_id,  & recipe are required
-
-    bool status = false;
-    psString det_id = psMetadataLookupStr(&status, config->args, "-det_id");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -det_id");
-        return false;
-    }
-    if (!det_id) {
-        psError(PS_ERR_UNKNOWN, true, "-det_id is required");
-        return false;
-    }
-    psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id");
-        return false;
-    }
-    if (!exp_id) {
-        psError(PS_ERR_UNKNOWN, true, "-exp_id is required");
-        return false;
-    }
-    psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id");
-        return false;
-    }
-    if (!exp_id) {
-        psError(PS_ERR_UNKNOWN, true, "-exp_id is required");
-        return false;
-    }
-    psString recipe = psMetadataLookupStr(&status, config->args, "-recip");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -recip");
-        return false;
-    }
-    if (!recipe) {
-        psError(PS_ERR_UNKNOWN, true, "-recip is required");
-        return false;
-    }
-
-    // iteration has a default value
-    psS32 iteration = psMetadataLookupS32(&status, config->args, "-iteration");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -iteration");
-        return false;
-    }
-    // accept is optional
-    bool accept = psMetadataLookupBool(&status, config->args, "-accept");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -recip");
-        return false;
-    }
-
-    // check det_id, exp_id against detInputExp
-    
-    // we have to generate our own where clause as we want to exclude -stats
-    // from the search
-    psMetadata *where = psMetadataAlloc();
-    if (!psMetadataAddS32(where, PS_LIST_TAIL, "det_id", 0, "==",
-            (psS32)atoi(det_id))) {
-        psError(PS_ERR_UNKNOWN, false, "failed to add item det_id");
-        psFree(where);
-        return false;
-    }
-    if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", 0, "==", exp_id)) {
-        psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
-        psFree(where);
-        return false;
-    }
-
-    psArray *inputExp = detInputExpSelectRowObjects(config->dbh, where, 0);
-    psFree(where);
-    if (!inputExp) {
-        psError(PS_ERR_UNKNOWN, true,
-    "det_id %s, exp_id %s does not corespond to an input exp", det_id, exp_id);
-        return false;
-    }
-
-    // if we've made it this far then we must have found a match
-    psFree(inputExp);
-
-    // create a new detResidExpg row and insert it
-    detResidExpRow *residExp = detResidExpRowAlloc(
-                (psS32)atol(det_id),
-                iteration,
-                exp_id,
-                class_id,
-                recipe,
-                accept
-            );
-
-    if (!detResidExpInsertObject(config->dbh, residExp)) {
-        psError(PS_ERR_UNKNOWN, false, "database error");
-        psFree(residExp);
-        return false;
-    }
-
-    psFree(residExp);
-
-    return true;
-}
-#endif
-
 static bool residexpMode(pxConfig *config)
 {
@@ -3316,4 +3212,11 @@
 
     psFree(residExps);
+
+    return true;
+}
+
+static bool residdetrunMode(pxConfig *config)
+{
+    PS_ASSERT_PTR_NON_NULL(config, false);
 
     return true;
