Index: trunk/ippTools/src/dettool.c
===================================================================
--- trunk/ippTools/src/dettool.c	(revision 14243)
+++ trunk/ippTools/src/dettool.c	(revision 14265)
@@ -70,5 +70,5 @@
 static bool addnormalizedexpMode(pxConfig *config);
 static bool normalizedexpMode(pxConfig *config);
-
+static bool revertnormalizedexpMode(pxConfig *config);
 // residimfile
 static bool toresidimfileMode(pxConfig *config);
@@ -156,8 +156,11 @@
         MODECASE(DETTOOL_MODE_ADDNORMALIZEDEXP, addnormalizedexpMode);
         MODECASE(DETTOOL_MODE_NORMALIZEDEXP,    normalizedexpMode);
+        MODECASE(DETTOOL_MODE_REVERTNORMALIZEDEXP, revertnormalizedexpMode);
+        // residimfile
         MODECASE(DETTOOL_MODE_TORESIDIMFILE,    toresidimfileMode);
         MODECASE(DETTOOL_MODE_ADDRESIDIMFILE,   addresidimfileMode);
+        MODECASE(DETTOOL_MODE_RESIDIMFILE,      residimfileMode);
+
         MODECASE(DETTOOL_MODE_TORESIDEXP,       toresidexpMode);
-        MODECASE(DETTOOL_MODE_RESIDIMFILE,      residimfileMode);
         MODECASE(DETTOOL_MODE_ADDRESIDEXP,      addresidexpMode);
         MODECASE(DETTOOL_MODE_RESIDEXP,         residexpMode);
@@ -4339,4 +4342,5 @@
 }
 
+
 static bool normalizedexpMode(pxConfig *config)
 {
@@ -4427,4 +4431,5 @@
     return true;
 }
+
 
 static  detNormalizedImfileRow *detNormalizedStatToDetNormalizedmfile(pxConfig *config, detNormalizedStatImfileRow *statImfile)
@@ -4524,4 +4529,37 @@
     );
 }
+
+
+static bool revertnormalizedexpMode(pxConfig *config)
+{
+    PS_ASSERT_PTR_NON_NULL(config, false);
+
+    psString query = pxDataGet("dettool_revertnormalizedexp.sql");
+    if (!query) {
+        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
+        return false;
+    }
+
+    if (config->where) {
+        psString whereClause = psDBGenerateWhereConditionSQL(config->where, "detNormalizedExp");
+        psStringAppend(&query, " AND %s", whereClause);
+        psFree(whereClause);
+    }
+
+    if (!p_psDBRunQuery(config->dbh, query)) {
+        psError(PS_ERR_UNKNOWN, false, "database error");
+        psFree(query);
+        return false;
+    }
+    psFree(query);
+
+    if (psDBAffectedRows(config->dbh) < 1) {
+        psError(PS_ERR_UNKNOWN, false, "should have affected atleast 1 row");
+        return false;
+    }
+
+    return true;
+}
+
 
 static bool toresidimfileMode(pxConfig *config)
