Index: trunk/ippTools/src/Makefile.am
===================================================================
--- trunk/ippTools/src/Makefile.am	(revision 12123)
+++ trunk/ippTools/src/Makefile.am	(revision 12131)
@@ -32,4 +32,5 @@
 	pxinject.h \
 	pxdata.h \
+	pxio.h \
 	pxtag.h \
 	pzgetexp.h \
@@ -48,4 +49,5 @@
 	pxtables.c \
 	pxdata.c \
+	pxio.c \
 	pxtag.c
 
Index: trunk/ippTools/src/camtool.c
===================================================================
--- trunk/ippTools/src/camtool.c	(revision 12123)
+++ trunk/ippTools/src/camtool.c	(revision 12131)
@@ -100,12 +100,14 @@
             "   rawExp.workdir"
             " FROM camPendingExp"
+            " JOIN chipProcessedExp"
+            "   USING(chip_id)"
             " JOIN rawExp"
-            "   USING(exp_tag)"
+            "   ON chipProcessedExp.exp_tag = rawExp.exp_tag"
             " LEFT JOIN camProcessedExp"
-            "   USING(exp_tag)"
+            "   on camPendingExp.cam_id = camPendingExp.cam_id"
             " LEFT JOIN camMask"
             "   ON camPendingExp.label = camMask.label"
             " WHERE"
-            "   camProcessedExp.exp_tag IS NULL"
+            "   camProcessedExp.cam_id IS NULL"
             "   AND camMask.label IS NULL"
     );
@@ -152,4 +154,10 @@
     }
 
+    if (!convertIdToStr(output)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
+        psFree(output);
+        return false;
+    }
+
     // negate simple so the default is true
     if (!ippdbPrintMetadatas(stdout, output, "camPendingExp", !simple)) {
@@ -170,4 +178,5 @@
     psString query = psStringCopy(
             "SELECT"
+            "   camPendingExp.cam_id,"
             "   chipProcessedImfile.*,"
             "   rawExp.camera,"
@@ -175,13 +184,13 @@
             " FROM camPendingExp"
             " JOIN chipProcessedImfile"
-            "   USING(exp_tag, chip_version)"
+            "   USING(chip_id)"
             " JOIN rawExp"
-            "   USING(exp_tag)"
+            "   ON chipProcessedImfile.exp_tag = rawExp.exp_tag"
             " LEFT JOIN camProcessedExp"
-            "   USING(exp_tag)"
+            "   ON camPendingExp.cam_id = camProcessedExp.cam_id"
             " LEFT JOIN camMask"
             "   ON camPendingExp.label = camMask.label"
             " WHERE"
-            "   camProcessedExp.exp_tag IS NULL"
+            "   camProcessedExp.cam_id IS NULL"
             "   AND camMask.label IS NULL"
     );
@@ -221,4 +230,28 @@
     }
 
+    if (!convertIdToStr(output)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
+        psFree(output);
+        return false;
+    }
+
+    if (!convertIdToStr(output)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
+        psFree(output);
+        return false;
+    }
+
+    if (!convertIdToStr(output)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
+        psFree(output);
+        return false;
+    }
+
+    if (!convertIdToStr(output)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
+        psFree(output);
+        return false;
+    }
+
     // negate simple so the default is true
     if (!ippdbPrintMetadatas(stdout, output, "chipProcessedImfile", !simple)) {
@@ -237,16 +270,15 @@
     PS_ASSERT_PTR_NON_NULL(config, false);
 
-    // det_id, exp_tag, recip
-    // are required
     bool status = false;
-    psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
-        return false;
-    }
-    if (!exp_tag) {
-        psError(PS_ERR_UNKNOWN, true, "-exp_tag is required");
-        return false;
-    }
+    psString cam_id = psMetadataLookupStr(&status, config->args, "-cam_id");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -cam_id");
+        return false;
+    }
+    if (!cam_id) {
+        psError(PS_ERR_UNKNOWN, true, "-cam_id is required");
+        return false;
+    }
+
     psString uri = psMetadataLookupStr(&status, config->args, "-uri");
     if (!status) {
@@ -258,4 +290,5 @@
         return false;
     }
+
     psString recipe = psMetadataLookupStr(&status, config->args, "-recip");
     if (!status) {
@@ -267,4 +300,5 @@
         return false;
     }
+
     psF64 bg = psMetadataLookupF64(&status, config->args, "-bg");
     if (!status) {
@@ -272,4 +306,5 @@
         return false;
     }
+
     psF64 bg_stdev = psMetadataLookupF64(&status, config->args, "-bg_stdev");
     if (!status) {
@@ -277,4 +312,5 @@
         return false;
     }
+
     psF64 bg_mean_stdev = psMetadataLookupF64(&status, config->args, "-bg_mean_stdev");
     if (!status) {
@@ -282,4 +318,5 @@
         return false;
     }
+
     psF32 sigma_ra = psMetadataLookupF32(&status, config->args, "-sigma_ra");
     if (!status) {
@@ -291,4 +328,5 @@
         return false;
     }
+
     psF32 sigma_dec = psMetadataLookupF32(&status, config->args, "-sigma_dec");
     if (!status) {
@@ -300,4 +338,5 @@
         return false;
     }
+
     psS32 nastro = psMetadataLookupS32(&status, config->args, "-nastro");
     if (!status) {
@@ -309,4 +348,5 @@
         return false;
     }
+
     psF32 zp_mean = psMetadataLookupF32(&status, config->args, "-zp_mean");
     if (!status) {
@@ -318,4 +358,5 @@
         return false;
     }
+
     psF32 zp_stdev = psMetadataLookupF32(&status, config->args, "-zp_stdev");
     if (!status) {
@@ -346,11 +387,11 @@
         " FROM camPendingExp"
         " LEFT JOIN camProcessedExp"
-        "   USING(exp_tag)"
+        "   USING(cam_id)"
         " WHERE"
-        "   camProcessedExp.exp_tag IS NULL"
-        "   AND camPendingExp.exp_tag = '%s'"
+        "   camProcessedExp.cam_id IS NULL"
+        "   AND camPendingExp.cam_id = '%s'"
     );
 
-    if (!p_psDBRunQuery(config->dbh, query, exp_tag)) {
+    if (!p_psDBRunQuery(config->dbh, query, cam_id)) {
         psError(PS_ERR_UNKNOWN, false, "database error");
         psFree(query);
@@ -382,7 +423,6 @@
     // create a new camProcessedImfile object
     camProcessedExpRow *row = camProcessedExpRowAlloc(
-        exp_tag,
-        pendingRow->cam_version,
-        pendingRow->chip_version,
+        pendingRow->cam_id,
+        pendingRow->chip_id,
         pendingRow->label,
         uri,
@@ -437,4 +477,5 @@
 }
 
+
 static bool processedexpMode(pxConfig *config)
 {
@@ -460,8 +501,10 @@
             "   rawExp.workdir"
             " FROM camProcessedExp"
+            " JOIN chipProcessedExp"
+            "   USING(chip_id)"
             " JOIN rawExp"
-            "   USING(exp_tag)"
+            "   chipProcessedExp.exp_tag = rawExp.exp_tag"
             " WHERE"
-            "   camProcessedExp.exp_tag IS NOT NULL"
+            "   camProcessedExp.cam_id IS NOT NULL" // bongus
     );
 
@@ -515,4 +558,28 @@
     }
 
+    if (!convertIdToStr(output)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
+        psFree(output);
+        return false;
+    }
+
+    if (!convertIdToStr(output)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
+        psFree(output);
+        return false;
+    }
+
+    if (!convertIdToStr(output)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
+        psFree(output);
+        return false;
+    }
+
+    if (!convertIdToStr(output)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
+        psFree(output);
+        return false;
+    }
+
     // negate simple so the default is true
     if (!ippdbPrintMetadatas(stdout, output, "camProcessedExp", !simple)) {
@@ -570,4 +637,5 @@
     return true;
 }
+
 
 static bool maskedMode(pxConfig *config)
@@ -605,4 +673,10 @@
     }
 
+    if (!convertIdToStr(output)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
+        psFree(output);
+        return false;
+    }
+
     // negative simple so the default is true
     if (!ippdbPrintMetadatas(stdout, output, "camMask", !simple)) {
@@ -617,4 +691,5 @@
 }
 
+
 static bool unblockMode(pxConfig *config)
 {
Index: trunk/ippTools/src/camtoolConfig.c
===================================================================
--- trunk/ippTools/src/camtoolConfig.c	(revision 12123)
+++ trunk/ippTools/src/camtoolConfig.c	(revision 12131)
@@ -46,12 +46,10 @@
     // -pendingexp
     psMetadata *pendingexpArgs = psMetadataAlloc();
-    psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-exp_tag", 0,
-            "search by exposure ID", NULL);
-    psMetadataAddS32(pendingexpArgs, PS_LIST_TAIL, "-chip_version", 0,
-            "search for exposures with this chip version", -1);
-    psMetadataAddS32(pendingexpArgs, PS_LIST_TAIL, "-cam_version", 0,
-            "search for exposures with this cam version", -1);
+    psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-cam_id", 0,
+            "search by camtool ID", NULL);
+    psMetadataAddStr(pendingexpArgs, PS_LIST_TAIL, "-chip_id", 0,
+            "search by chiptool ID", NULL);
     psMetadataAddU64(pendingexpArgs, PS_LIST_TAIL, "-limit",  0,
-        "limit result set to N items", 0);
+            "limit result set to N items", 0);
     psMetadataAddBool(pendingexpArgs, PS_LIST_TAIL, "-simple", 0,
             "use the simple output format", false);
@@ -60,6 +58,8 @@
     // -pendingimfile
     psMetadata *pendingimfileArgs = psMetadataAlloc();
-    psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-exp_tag", 0,
-            "search by exposure ID", NULL);
+    psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-cam_id", 0,
+            "search by camtool ID", NULL);
+    psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-chip_id", 0,
+            "search by chiptool ID", NULL);
     psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-class", 0,
             "search by class", NULL);
@@ -72,6 +72,8 @@
     // -addprocessedexp
     psMetadata *addprocessedexpArgs = psMetadataAlloc();
-    psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-exp_tag", 0,
-            "define exp ID (required)", NULL);
+    psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-cam_id", 0,
+            "define camtool ID (required)", NULL);
+    psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-chip_id", 0,
+            "define chiptool ID (required)", NULL);
     psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-uri", 0,
             "define URI (required)", NULL);
@@ -96,34 +98,34 @@
     psMetadataAddStr(addprocessedexpArgs, PS_LIST_TAIL, "-path_base", 0,
             "define banana 1", NULL);
-    psMetadataAddS8(addprocessedexpArgs, PS_LIST_TAIL, "-code",  0,
-        "set fault code (required)", 0);
-    psMetadataAddBool(pendingexpArgs, PS_LIST_TAIL, "-faulted",  0,
-        "only return imfiles with a fault status set", false);
+    psMetadataAddS16(addprocessedexpArgs, PS_LIST_TAIL, "-code",  0,
+            "set fault code (required)", 0);
+    psMetadataAddBool(addprocessedexpArgs, PS_LIST_TAIL, "-faulted",  0,
+            "only return imfiles with a fault status set", false);
 
     // -processedexp
     psMetadata *processedexpArgs = psMetadataAlloc();
-    psMetadataAddStr(processedexpArgs, PS_LIST_TAIL, "-exp_tag", 0,
-            "search by exposure ID", NULL);
-    psMetadataAddS32(processedexpArgs, PS_LIST_TAIL, "-chip_version", 0,
-            "search for exposures with this chip version", -1);
-    psMetadataAddS32(processedexpArgs, PS_LIST_TAIL, "-cam_version", 0,
-            "search for exposures with this cam version", -1);
+    psMetadataAddStr(processedexpArgs, PS_LIST_TAIL, "-cam_id", 0,
+            "search by camtool ID", NULL);
+    psMetadataAddStr(processedexpArgs, PS_LIST_TAIL, "-chip_id", 0,
+            "search by chiptool ID", NULL);
     psMetadataAddU64(processedexpArgs, PS_LIST_TAIL, "-limit",  0,
-        "limit result set to N items", 0);
+            "limit result set to N items", 0);
     psMetadataAddBool(processedexpArgs, PS_LIST_TAIL, "-simple", 0,
             "use the simple output format", false);
     psMetadataAddBool(processedexpArgs, PS_LIST_TAIL, "-faulted",  0,
-        "only return imfiles with a fault status set", false);
+            "only return imfiles with a fault status set", false);
 
     // -updateprocessedexp
     psMetadata *updateprocessedexpArgs = psMetadataAlloc();
-    psMetadataAddStr(updateprocessedexpArgs, PS_LIST_TAIL, "-exp_tag",  0,
-        "search by exposure ID", NULL);
+    psMetadataAddStr(updateprocessedexpArgs, PS_LIST_TAIL, "-cam_id", 0,
+            "search by camtool ID", NULL);
+    psMetadataAddStr(updateprocessedexpArgs, PS_LIST_TAIL, "-chip_id",  0,
+            "search by chiptool ID", NULL);
     psMetadataAddStr(updateprocessedexpArgs, PS_LIST_TAIL, "-class",  0,
-        "search by class", NULL);
+            "search by class", NULL);
     psMetadataAddStr(updateprocessedexpArgs, PS_LIST_TAIL, "-class_id",  0,
-        "search by class ID", NULL);
-    psMetadataAddS8(updateprocessedexpArgs, PS_LIST_TAIL, "-code",  0,
-        "set fault code (required)", 0);
+            "search by class ID", NULL);
+    psMetadataAddS16(updateprocessedexpArgs, PS_LIST_TAIL, "-code",  0,
+            "set fault code (required)", 0);
 
     // -block
@@ -221,5 +223,28 @@
     config->where = psMetadataAlloc();
 
-    addWhereStr(exp_tag);
+{
+    psString str = NULL;
+    bool status = false;
+    if ((str = psMetadataLookupStr(&status, config->args, "-cam_id"))) {
+        if (!psMetadataAddS64(config->where, PS_LIST_TAIL, "cam_id", 0, "==", (psS64)atoll(str))) {
+            psError(PS_ERR_UNKNOWN, false, "failed to add item cam_id");
+            psFree(config);
+            return NULL;
+        }
+    }
+}
+
+{
+    psString str = NULL;
+    bool status = false;
+    if ((str = psMetadataLookupStr(&status, config->args, "-chip_id"))) {
+        if (!psMetadataAddS64(config->where, PS_LIST_TAIL, "chip_id", 0, "==", (psS64)atoll(str))) {
+            psError(PS_ERR_UNKNOWN, false, "failed to add item chip_id");
+            psFree(config);
+            return NULL;
+        }
+    }
+}
+
     // convert '-inst' to 'camera'
     {
Index: trunk/ippTools/src/chiptool.c
===================================================================
--- trunk/ippTools/src/chiptool.c	(revision 12123)
+++ trunk/ippTools/src/chiptool.c	(revision 12131)
@@ -169,4 +169,5 @@
             "INSERT INTO chipPendingExp\n"
             "   SElECT\n"
+            "       0\n"            // chip_id
             "       exp_tag,\n"
             "       'my recipe',\n"  // recipe
@@ -269,4 +270,10 @@
     }
 
+    if (!convertIdToStr(output)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
+        psFree(output);
+        return false;
+    }
+
     // negative simple so the default is true
     if (!ippdbPrintMetadatas(stdout, output, "chipPendingImfile", !simple)) {
@@ -307,12 +314,12 @@
         psMetadata *where = psMetadataAlloc();
         bool status = false;
-        psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");        if (!status) {
-            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
+        psString chip_id = psMetadataLookupStr(&status, config->args, "-chip_id");        if (!status) {
+            psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -chip_id");
             psFree(query);
             return false;
         }
-        if (exp_tag) {
-            if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_tag", 0, "==", exp_tag)) {
-                psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
+        if (chip_id) {
+            if (!psMetadataAddStr(where, PS_LIST_TAIL, "chip_id", 0, "==", chip_id)) {
+                psError(PS_ERR_UNKNOWN, false, "failed to add item chip_id");
                 psFree(where);
                 psFree(query);
@@ -320,4 +327,5 @@
             }
         }
+
         psString class_id = psMetadataLookupStr(&status, config->args, "-class_id");
         if (!status) {
@@ -517,4 +525,10 @@
     }
 
+    if (!convertIdToStr(output)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
+        psFree(output);
+        return false;
+    }
+
     // negative simple so the default is true
     if (!ippdbPrintMetadatas(stdout, output, "chipProcessedImfile", !simple)) {
@@ -606,4 +620,10 @@
             return false;
         }
+    }
+
+    if (!convertIdToStr(output)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
+        psFree(output);
+        return false;
     }
 
@@ -799,7 +819,7 @@
 
     return chipProcessedImfileRowAlloc(
+        imfile->chip_id,
         imfile->exp_tag,
-        imfile->chip_version,
-        imfile->guide_version,
+        imfile->guide_id,
         imfile->class_id,
         recipe,
@@ -819,7 +839,7 @@
  
     return chipProcessedExpRowAlloc(
+        pendingExp->chip_id,
         pendingExp->exp_tag,
-        pendingExp->chip_version,
-        pendingExp->guide_version,
+        pendingExp->guide_id,
         pendingExp->label,
         pendingExp->expgroup,
@@ -834,7 +854,6 @@
 
     return camPendingExpRowAlloc(
-        pendingExp->exp_tag,
-        0x0,        // cam version
-        pendingExp->chip_version,
+        0,                      // cam version, assigned by db
+        pendingExp->chip_id,
         pendingExp->label,
         pendingExp->expgroup,
Index: trunk/ippTools/src/chiptoolConfig.c
===================================================================
--- trunk/ippTools/src/chiptoolConfig.c	(revision 12123)
+++ trunk/ippTools/src/chiptoolConfig.c	(revision 12131)
@@ -91,16 +91,18 @@
     // -pendingimfile
     psMetadata *pendingimfileArgs = psMetadataAlloc();
+    psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-chip_id",  0,
+            "search by chip ID", NULL);
     psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-exp_tag",  0,
-            "define exposure ID", NULL);
+            "search by exposure ID", NULL);
     psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-class",  0,
-            "define class", NULL);
+            "search by class", NULL);
     psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-class_id",  0,
-            "define class ID", NULL);
+            "search by class ID", NULL);
     psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-inst",  0,
-            "define camera of interest", NULL);
+            "search by camera of interest", NULL);
     psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-filter",  0,
-            "define filter of interest", NULL); 
+            "search by filter of interest", NULL); 
     psMetadataAddStr(pendingimfileArgs, PS_LIST_TAIL, "-uri",  0,
-            "define URL", NULL);
+            "search by URL", NULL);
     psMetadataAddU64(pendingimfileArgs, PS_LIST_TAIL, "-limit",  0,
             "limit result set to N items", 0);
@@ -110,6 +112,10 @@
     // -addprocessedimfile
     psMetadata *addprocessedimfileArgs = psMetadataAlloc();
+    psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-chip_id",  0,
+            "define chip ID (required)", NULL);
+#if 0
     psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-exp_tag",  0,
-            "define exp_tag (required)", NULL); 
+            "define exposure tag (required) (XXX redudant with chip_id)", NULL);
+#endif
     psMetadataAddStr(addprocessedimfileArgs, PS_LIST_TAIL, "-class_id",  0,
             "define class ID", NULL);
@@ -131,4 +137,6 @@
     // -processedimfile
     psMetadata *processedimfileArgs = psMetadataAlloc();
+    psMetadataAddStr(processedimfileArgs, PS_LIST_TAIL, "-chip_id",  0,
+            "define chip ID (required)", NULL);
     psMetadataAddStr(processedimfileArgs, PS_LIST_TAIL, "-exp_tag",  0,
             "define exposure ID", NULL);
@@ -152,4 +160,6 @@
     // -updateprocessedimfile
     psMetadata *updateprocessedimfileArgs = psMetadataAlloc();
+    psMetadataAddStr(updateprocessedimfileArgs, PS_LIST_TAIL, "-chip_id",  0,
+            "define chip ID (required)", NULL);
     psMetadataAddStr(updateprocessedimfileArgs, PS_LIST_TAIL, "-exp_tag",  0,
             "search by exposure ID", NULL);
@@ -257,4 +267,16 @@
     config->where = psMetadataAlloc();
 
+{
+    psString str = NULL;
+    bool status = false;
+    if ((str = psMetadataLookupStr(&status, config->args, "-chip_id"))) {
+        if (!psMetadataAddS64(config->where, PS_LIST_TAIL, "chip_id", 0, "==", (psS64)atoll(str))) {
+            psError(PS_ERR_UNKNOWN, false, "failed to add item chip_id");
+            psFree(config);
+            return NULL;
+        }
+    }
+}
+
     addWhereStr(exp_tag);
     // convert '-inst' to 'camera'
Index: trunk/ippTools/src/dettool.c
===================================================================
--- trunk/ippTools/src/dettool.c	(revision 12123)
+++ trunk/ippTools/src/dettool.c	(revision 12131)
@@ -25,4 +25,6 @@
 #include <string.h>
 #include <stdlib.h>
+#include <stdint.h>
+
 #include <ippdb.h>
 
@@ -70,5 +72,4 @@
 static bool register_detrend_imfileMode(pxConfig *config);
 
-static bool convertDetIdToStr(psArray *mds);
 static detNormalizedStatImfileRow *detStackedToDetNormalizedStatImfile(pxConfig *config, detStackedImfileRow *stackedImfile);
 static  detNormalizedImfileRow *detNormalizedStatToDetNormalizedmfile(pxConfig *config, detNormalizedStatImfileRow *statImfile);
@@ -598,7 +599,6 @@
     }
 
-    // convert det_id to a str externally
-    if (!convertDetIdToStr(detRuns)) {
-        psError(PS_ERR_UNKNOWN, false, "failed to convert det_id to a string");
+    if (!convertIdToStr(detRuns)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
         psFree(detRuns);
         return false;
@@ -616,4 +616,5 @@
 }
 
+#if 0
 // This function is used to convert the det_id from an int, as it is used
 // internally, to be a string for external use.  The rational being that we may
@@ -640,4 +641,5 @@
     return true;
 }
+#endif
 
 static bool definebyqueryMode(pxConfig *config)
@@ -1243,5 +1245,5 @@
 
     // convert det_id to a string externaly
-    if (!convertDetIdToStr(detRuns)) {
+    if (!convertIdToStr(detRuns)) {
         psError(PS_ERR_UNKNOWN, false, "failed to convert det_id to a string");
         psFree(detRuns);
@@ -1281,5 +1283,5 @@
     {
         psMetadata *where = psMetadataAlloc();
-        psMetadataAddS32(where, PS_LIST_TAIL, "det_id", 0, "==", (psS32)atoi(det_id));
+        psMetadataAddS64(where, PS_LIST_TAIL, "det_id", 0, "==", (psS64)atoll(det_id));
         detRuns = detRunSelectRowObjects(config->dbh, where, 0);
         psFree(where);
@@ -1291,5 +1293,5 @@
     // sanity check the result... we should have only found one det_id
     if (psArrayLength(detRuns) != 1) {
-        psAbort("found more then one detRun matching det_id %d(this should not happen)", (psS32)atoi(det_id));
+        psAbort("found more then one detRun matching det_id %" PRId64 " (this should not happen)", (psS64)atoll(det_id));
         return false;                   // unreachable
     }
@@ -1624,5 +1626,5 @@
     psFree(time_filter);
 
-    if (!p_psDBRunQuery(config->dbh, query, (psS32)newDet_id, (psS32)atoi(det_id))) {
+    if (!p_psDBRunQuery(config->dbh, query, (psS64)newDet_id, (psS64)atoll(det_id))) {
         psError(PS_ERR_UNKNOWN, false, "database error");
         psFree(query);
@@ -1666,7 +1668,7 @@
 
     // convert det_id to a string externaly
-    if (!convertDetIdToStr(newDetRuns)) {
-        psError(PS_ERR_UNKNOWN, false, "failed to convert det_id to a string");
-        psFree(newDetRuns);
+    if (!convertIdToStr(detRuns)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
+        psFree(detRuns);
         return false;
     }
@@ -1701,6 +1703,6 @@
 
     // convert det_id to a string externaly
-    if (!convertDetIdToStr(runs)) {
-        psError(PS_ERR_UNKNOWN, false, "failed to convert det_id to a string");
+    if (!convertIdToStr(runs)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
         psFree(runs);
         return false;
@@ -1784,6 +1786,6 @@
 
     // convert det_id to a string externaly
-    if (!convertDetIdToStr(output)) {
-        psError(PS_ERR_UNKNOWN, false, "failed to convert det_id to a string");
+    if (!convertIdToStr(output)) {
+        psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
         psFree(output);
         return false;
@@ -2907,5 +2909,5 @@
     psMetadata *where = psMetadataAlloc();
     if (!psMetadataAddS32(where, PS_LIST_TAIL, "det_id", 0, "==",
-            (psS32)atoi(det_id))) {
+            (psS64)atoll(det_id))) {
         psError(PS_ERR_UNKNOWN, false, "failed to add item exp_tag");
         psFree(where);
@@ -4870,5 +4872,5 @@
             return false;
         }
-        if (!psMetadataAddS32(where, PS_LIST_TAIL, "det_id", 0, "==", (psS32)atoi(det_id))) {
+        if (!psMetadataAddS64(where, PS_LIST_TAIL, "det_id", 0, "==", (psS64)atoll(det_id))) {
             psError(PS_ERR_UNKNOWN, false, "failed to add item det_id");
             psFree(where);
@@ -6332,5 +6334,5 @@
             0.0,        // solang max
             label,      // label
-            atoi(parent)
+            (psS64)atoll(parent)
     )) {
         psError(PS_ERR_UNKNOWN, false, "database error");
@@ -6435,5 +6437,5 @@
     // the det_id is valid
     if (!detNormalizedImfileInsert(config->dbh,
-            (psS32)atoi(det_id),
+            (psS64)atoll(det_id),
             0,  // the iteration is fixed at 0
             class_id,
Index: trunk/ippTools/src/difftool.c
===================================================================
--- trunk/ippTools/src/difftool.c	(revision 12123)
+++ trunk/ippTools/src/difftool.c	(revision 12131)
@@ -281,6 +281,6 @@
     // constrants
     if (!diffInputSkyfileInsert(config->dbh,
-            (psS32)atoi(diff_id),
-            (psS32)atoi(warp_id),
+            (psS64)atoll(diff_id),
+            (psS64)atoll(warp_id),
             skycell_id,
             tess_id,
@@ -322,6 +322,10 @@
         " JOIN warpInputExp\n"
         "   ON diffInputSkyfile.warp_id    = warpInputExp.warp_id\n"
+        " JOIN camProcessedExp\n"
+        "   ON warpInputExp.cam_id = camProcessedExp.cam_id\n"
+        " JOIN chipProcessedExp\n"
+        "   ON camProcessedExp.chip_id = chipProcessedExp.chip_id\n"
         " JOIN rawExp\n"
-        "   ON warpInputExp.exp_tag        = rawExp.exp_tag\n"
+        "   ON chipProcessedExp.exp_tag = rawExp.exp_tag\n"
         " WHERE\n"
         "   diffRun.state = 'run'\n"
@@ -379,4 +383,10 @@
 
     if (psArrayLength(output)) {
+        if (!convertIdToStr(output)) {
+            psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
+            psFree(output);
+            return false;
+        }
+
         // negative simple so the default is true
         if (!ippdbPrintMetadatas(stdout, output, "diffInputSkyfile", !simple)) {
@@ -474,4 +484,10 @@
 
     if (psArrayLength(output)) {
+        if (!convertIdToStr(output)) {
+            psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
+            psFree(output);
+            return false;
+        }
+
         // negative simple so the default is true
         if (!ippdbPrintMetadatas(stdout, output, "diffSkyfile", !simple)) {
@@ -532,5 +548,5 @@
 
     if (!diffSkyfileInsert(config->dbh,
-            (psS32)atoi(diff_id),
+            (psS64)atoll(diff_id),
             uri,
             bg,
@@ -637,4 +653,10 @@
 
     if (psArrayLength(output)) {
+        if (!convertIdToStr(output)) {
+            psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
+            psFree(output);
+            return false;
+        }
+
         // negative simple so the default is true
         if (!ippdbPrintMetadatas(stdout, output, "diffSkyfile", !simple)) {
Index: trunk/ippTools/src/difftoolConfig.c
===================================================================
--- trunk/ippTools/src/difftoolConfig.c	(revision 12123)
+++ trunk/ippTools/src/difftoolConfig.c	(revision 12131)
@@ -239,5 +239,5 @@
     bool status = false;
     if ((str = psMetadataLookupStr(&status, config->args, "-diff_id"))) {
-        if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "diff_id", 0, "==", (psS32)atoi(str))) {
+        if (!psMetadataAddS64(config->where, PS_LIST_TAIL, "diff_id", 0, "==", (psS64)atoll(str))) {
             psError(PS_ERR_UNKNOWN, false, "failed to add item diff_id");
             psFree(config);
@@ -250,5 +250,5 @@
     bool status = false;
     if ((str = psMetadataLookupStr(&status, config->args, "-warp_id"))) {
-        if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "warp_id", 0, "==", (psS32)atoi(str))) {
+        if (!psMetadataAddS64(config->where, PS_LIST_TAIL, "warp_id", 0, "==", (psS64)atoll(str))) {
             psError(PS_ERR_UNKNOWN, false, "failed to add item warp_id");
             psFree(config);
Index: trunk/ippTools/src/pxio.c
===================================================================
--- trunk/ippTools/src/pxio.c	(revision 12131)
+++ trunk/ippTools/src/pxio.c	(revision 12131)
@@ -0,0 +1,59 @@
+/*
+ * pxio.c
+ *
+ * Copyright (C) 2007  Joshua Hoblitt
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * program; see the file COPYING. If not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVB_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdbool.h>
+
+#include <pslib.h>
+
+#include "pxtools.h"
+#include "pxio.h"
+
+bool convertIdToStr(psArray *mds)
+{
+    PS_ASSERT_PTR_NON_NULL(mds, false);
+
+    char *ids[] = {"guide_id", "chip_id", "cam_id", "det_id", "warp_id", "diff_id", "stack_id", NULL};
+
+    // loop over array of metadatas
+    for (long i = 0; i < psArrayLength(mds); i++) {
+        psMetadata *md = mds->data[i];
+        // loop over array of ID fields
+        for (int j = 0; ids[j] != NULL; j++) {
+            char *name = ids[j];
+            bool status = false;
+            psS64 numeric_id = psMetadataLookupS64(&status, md, name);
+            if (!status) {
+                continue;
+//                psError(PS_ERR_UNKNOWN, false, "failed to lookup value for %s",
+//                        name);
+ //               return false;
+            }
+            psMetadataRemoveKey(md, name);
+            psString string_id = psDBIntToString((psU64)numeric_id);
+            psMetadataAddStr(md, PS_LIST_HEAD, name, 0, NULL, string_id);
+            psFree(string_id);
+        }
+    }
+
+    return true;
+}
Index: trunk/ippTools/src/pxio.h
===================================================================
--- trunk/ippTools/src/pxio.h	(revision 12131)
+++ trunk/ippTools/src/pxio.h	(revision 12131)
@@ -0,0 +1,27 @@
+/*
+ * pxio.h
+ *
+ * Copyright (C) 2007  Joshua Hoblitt
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * program; see the file COPYING. If not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef PXIO_H
+#define PXIO_H 1
+
+#include <pslib.h>
+
+bool convertIdToStr(psArray *mds);
+
+#endif // PXIO_H
Index: trunk/ippTools/src/pxtools.h
===================================================================
--- trunk/ippTools/src/pxtools.h	(revision 12123)
+++ trunk/ippTools/src/pxtools.h	(revision 12131)
@@ -27,5 +27,8 @@
 # include <psmodules.h>
 # include <ippdb.h>
+
 # include "pxtoolsErrorCodes.h"
+# include "pxio.h"
+# include "pxdata.h"
 
 // load these values from the db in the init stage
Index: trunk/ippTools/src/pzgetimfiles.c
===================================================================
--- trunk/ippTools/src/pzgetimfiles.c	(revision 12123)
+++ trunk/ippTools/src/pzgetimfiles.c	(revision 12131)
@@ -624,5 +624,5 @@
             return NULL;
         }
-        if (!psMetadataAddS32(md, PS_LIST_TAIL, "bytes", 0, NULL, (psS32)atoi(bytes))) {
+        if (!psMetadataAddS64(md, PS_LIST_TAIL, "bytes", 0, NULL, (psS64)atoll(bytes))) {
             psError(PS_ERR_UNKNOWN, false, "failed to add item bytes");
             psFree(md);
Index: trunk/ippTools/src/regtool.c
===================================================================
--- trunk/ippTools/src/regtool.c	(revision 12123)
+++ trunk/ippTools/src/regtool.c	(revision 12131)
@@ -41,5 +41,5 @@
 // static guidePendingExpRow *newToP1PendingExp(newExpRow *newExp);
 static chipPendingExpRow *newTochipPendingExp(pxConfig *config, newExpRow *newExp);
-static chipPendingImfileRow *rawImfileTochipPendingImfile(pxConfig *config, rawImfileRow *rawImfile);
+static chipPendingImfileRow *rawImfileTochipPendingImfile(pxConfig *config, psS64 chip_id, rawImfileRow *rawImfile);
 
 static rawExpRow *newToRawExp(pxConfig *config, newExpRow *exp);
@@ -664,4 +664,7 @@
             return false;
         }
+
+        // get the chip_id for the imfiles
+        psS64 chip_id = psDBLastInsertID(config->dbh);
         psFree(chipPendingExp);
 
@@ -712,5 +715,5 @@
         for (long i = 0; i < psArrayLength(rawImfiles); i++) {
             rawImfileRow *rawImfile = rawImfiles->data[i];
-            chipPendingImfileRow *pendingImfile = rawImfileTochipPendingImfile(config, rawImfile);
+            chipPendingImfileRow *pendingImfile = rawImfileTochipPendingImfile(config, chip_id, rawImfile);
             if (!chipPendingImfileInsertObject(config->dbh, pendingImfile)){
                 // rollback
@@ -890,11 +893,11 @@
 
     chipPendingExpRow *chipExp = chipPendingExpRowAlloc(
-        exp->exp_tag,
-        0x0,            // chip version XXX calc version number
-        0xdeadbeef,     // guide version
-        label,
-        "my recipe",
-        NULL,           // groupa
-        NULL            // dvodb
+            0,              // chip ID, assigned by db
+            exp->exp_tag,
+            0xdeadbeef,     // guide version
+            label,
+            "my recipe",    // recipe
+            NULL,           // expgroup
+            NULL            // dvodb
     );
 
@@ -903,13 +906,13 @@
 
 
-static chipPendingImfileRow *rawImfileTochipPendingImfile(pxConfig *config, rawImfileRow *rawImfile)
+static chipPendingImfileRow *rawImfileTochipPendingImfile(pxConfig *config, psS64 chip_id, rawImfileRow *rawImfile)
 {
     return chipPendingImfileRowAlloc(
-        rawImfile->exp_tag,
-        0x0,          // chip version XXX calc version number
-        0xdeadbeef,   // guide version
-        rawImfile->class_id,
-        "my recipe",
-        rawImfile->uri
+            chip_id,
+            rawImfile->exp_tag,
+            0xdeadbeef,     // guide version
+            rawImfile->class_id,
+            "my recipe",    // recipe
+            rawImfile->uri
     );
 }
Index: trunk/ippTools/src/stacktool.c
===================================================================
--- trunk/ippTools/src/stacktool.c	(revision 12123)
+++ trunk/ippTools/src/stacktool.c	(revision 12131)
@@ -192,5 +192,5 @@
             return false;
         }
-        if (!stackInputSkyfileInsert(config->dbh, run->stack_id, atoi((char *)item->data.V))) {
+        if (!stackInputSkyfileInsert(config->dbh, run->stack_id, (psS64)atoll((char *)item->data.V))) {
             if (!psDBRollback(config->dbh)) {
                 psError(PS_ERR_UNKNOWN, false, "database error");
@@ -296,6 +296,6 @@
     // constrants
     if (!stackInputSkyfileInsert(config->dbh,
-            (psS32)atoi(stack_id),
-            (psS32)atoi(warp_id)
+            (psS64)atoll(stack_id),
+            (psS64)atoll(warp_id)
         )) {
         psError(PS_ERR_UNKNOWN, false, "database error");
@@ -388,4 +388,10 @@
 
     if (psArrayLength(output)) {
+        if (!convertIdToStr(output)) {
+            psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
+            psFree(output);
+            return false;
+        }
+
         // negative simple so the default is true
         if (!ippdbPrintMetadatas(stdout, output, "stackInputSkyfile", !simple)) {
@@ -477,4 +483,10 @@
 
     if (psArrayLength(output)) {
+        if (!convertIdToStr(output)) {
+            psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
+            psFree(output);
+            return false;
+        }
+
         // negative simple so the default is true
         if (!ippdbPrintMetadatas(stdout, output, "stackSumSkyfile", !simple)) {
@@ -539,5 +551,5 @@
     // constrants
     if (!stackSumSkyfileInsert(config->dbh,
-            (psS32)atoi(stack_id),
+            (psS64)atoll(stack_id),
             uri,
             bg,
@@ -642,4 +654,10 @@
 
     if (psArrayLength(output)) {
+        if (!convertIdToStr(output)) {
+            psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
+            psFree(output);
+            return false;
+        }
+
         if (!ippdbPrintMetadatas(stdout, output, "stackSumSkyfile", !simple)) {
             psError(PS_ERR_UNKNOWN, false, "failed to print array");
Index: trunk/ippTools/src/stacktoolConfig.c
===================================================================
--- trunk/ippTools/src/stacktoolConfig.c	(revision 12123)
+++ trunk/ippTools/src/stacktoolConfig.c	(revision 12131)
@@ -226,5 +226,5 @@
     bool status = false;
     if ((str = psMetadataLookupStr(&status, config->args, "-warp_id"))) {
-        if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "warp_id", 0, "==", (psS32)atoi(str))) {
+        if (!psMetadataAddS64(config->where, PS_LIST_TAIL, "warp_id", 0, "==", (psS64)atoll(str))) {
             psError(PS_ERR_UNKNOWN, false, "failed to add item warp_id");
             psFree(config);
Index: trunk/ippTools/src/warptool.c
===================================================================
--- trunk/ippTools/src/warptool.c	(revision 12123)
+++ trunk/ippTools/src/warptool.c	(revision 12131)
@@ -239,18 +239,11 @@
     }
 
-    psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_tag");
-        return false;
-    }
-    if (!exp_tag) {
-        psError(PS_ERR_UNKNOWN, true, "-exp_tag is required");
-        return false;
-    }
-
-    // defaults to 0
-    psS32 cam_version = psMetadataLookupS32(&status, config->args, "-cam_version");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -cam_version");
+    psString cam_id = psMetadataLookupStr(&status, config->args, "-cam_id");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -cam_id");
+        return false;
+    }
+    if (!cam_id) {
+        psError(PS_ERR_UNKNOWN, true, "-cam_id is required");
         return false;
     }
@@ -267,7 +260,6 @@
     // constrants
     if (!warpInputExpInsert(config->dbh,
-            (psS32)atoi(warp_id),
-            exp_tag,
-            cam_version,
+            (psS64)atoll(warp_id),
+            (psS64)atoll(cam_id),
             magiced
         )) {
@@ -299,6 +291,5 @@
         "   USING(warp_id)\n"
         " JOIN camProcessedExp\n"
-        "   ON warpInputExp.exp_tag = camProcessedExp.exp_tag\n"
-        "   AND warpInputExp.cam_version = camProcessedExp.cam_version\n"
+        "   ON warpInputExp.cam_id = camProcessedExp.cam_id\n"
         " WHERE\n"
         "   warpRun.state = 'run'\n"
@@ -357,4 +348,10 @@
 
     if (psArrayLength(output)) {
+        if (!convertIdToStr(output)) {
+            psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
+            psFree(output);
+            return false;
+        }
+
         // negative simple so the default is true
         if (!ippdbPrintMetadatas(stdout, output, "warpInputExp", !simple)) {
@@ -386,10 +383,14 @@
         "SELECT\n"
         "   rawImfile.*,\n"
-        "   warpInputExp.cam_version\n"
+        "   warpInputExp.cam_id\n"
         " FROM warpRun\n"
         " JOIN warpInputExp\n"
         "   USING(warp_id)\n"
+        " JOIN camProcessedExp\n"
+        "   ON warpInputExp.cam_id = camProcessedExp.cam_id"
+        " JOIN chipProcessedExp\n"
+        "   ON camProcessedExp.chip_id = chipProcessedExp.chip_id"
         " JOIN rawImfile\n" // is there any reason not to refer back to rawimfiles?
-        "   ON warpInputExp.exp_tag = rawImfile.exp_tag\n"
+        "   ON chipProcessedExp.exp_tag = rawImfile.exp_tag\n"
         " WHERE\n"
         "   warpRun.state = 'run'\n"
@@ -446,4 +447,10 @@
 
     if (psArrayLength(output)) {
+        if (!convertIdToStr(output)) {
+            psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
+            psFree(output);
+            return false;
+        }
+
         // negative simple so the default is true
         if (!ippdbPrintMetadatas(stdout, output, "warpInputImfile", !simple)) {
@@ -482,18 +489,17 @@
         "   USING(warp_id)\n"
         " JOIN camProcessedExp\n"
-        "   ON warpInputExp.exp_tag = camProcessedExp.exp_tag\n"
-        "   AND warpInputExp.cam_version = camProcessedExp.cam_version\n"
+        "   ON warpInputExp.cam_id = camProcessedExp.cam_id\n"
+        " JOIN chipProcessedExp\n"
+        "   ON camProcessedExp.chip_id = chipProcessedExp.chip_id"
         " JOIN rawExp\n"
-        "   ON camProcessedExp.exp_tag = rawExp.exp_tag\n"
+        "   ON chipProcessedExp.exp_tag = rawExp.exp_tag\n"
         " LEFT JOIN warpSkyCellMap\n"
         "   ON warpInputExp.warp_id = warpSkyCellMap.warp_id\n"
-        "   AND warpInputExp.exp_tag = warpSkyCellMap.exp_tag\n"
-        "   AND warpInputExp.cam_version = warpSkyCellMap.cam_version\n"
+        "   AND warpInputExp.cam_id = warpSkyCellMap.cam_id\n"
         " WHERE\n"
         "   warpRun.state = 'run'\n"
         "   AND camProcessedExp.fault = 0\n"
         "   AND warpSkyCellMap.warp_id IS NULL\n"
-        "   AND warpSkyCellMap.exp_tag IS NULL\n"
-        "   AND warpSkyCellMap.cam_version IS NULL\n"
+        "   AND warpSkyCellMap.cam_id IS NULL\n"
     );
 
@@ -549,4 +555,10 @@
 
     if (psArrayLength(output)) {
+        if (!convertIdToStr(output)) {
+            psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
+            psFree(output);
+            return false;
+        }
+
         // negative simple so the default is true
         if (!ippdbPrintMetadatas(stdout, output, "warpInputExp", !simple)) {
@@ -681,6 +693,8 @@
         " JOIN warpSkyCellMap\n"
         "   USING(warp_id)\n"
+        " JOIN camProcessedExp\n"
+        "   ON warpSkyCellMap.cam_id = camProcessedExp.cam_id"
         " JOIN chipProcessedImfile\n"
-        "   ON warpSkyCellMap.exp_tag = chipProcessedImfile.exp_tag\n"
+        "   ON camProcessedExp.chip_id = chipProcessedImfile.chip_id"
         "   AND warpSkyCellMap.class_id = chipProcessedImfile.class_id\n"
         " WHERE\n"
@@ -739,4 +753,10 @@
 
     if (psArrayLength(output)) {
+        if (!convertIdToStr(output)) {
+            psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
+            psFree(output);
+            return false;
+        }
+
         // negative simple so the default is true
         if (!ippdbPrintMetadatas(stdout, output, "warpSkyCellMap", !simple)) {
@@ -773,6 +793,10 @@
         " JOIN warpSkyCellMap\n"
         "   USING(warp_id)\n"
+        " JOIN camProcessedExp\n"
+        "   ON warpSkyCellMap.cam_id = camProcessedExp.cam_id"
+        " JOIN chipProcessedExp\n"
+        "   ON camProcessedExp.chip_id = chipProcessedExp.chip_id"
         " JOIN rawExp\n"
-        "   ON warpSkyCellMap.exp_tag = rawExp.exp_tag\n"
+        "   ON chipProcessedExp.exp_tag = rawExp.exp_tag\n"
         " LEFT JOIN warpSkyfile\n"
         "   ON warpRun.warp_id = warpSkyfile.warp_id\n"
@@ -837,4 +861,10 @@
 
     if (psArrayLength(output)) {
+        if (!convertIdToStr(output)) {
+            psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
+            psFree(output);
+            return false;
+        }
+
         // negative simple so the default is true
         if (!ippdbPrintMetadatas(stdout, output, "warpPendingSkyCell", !simple)) {
@@ -918,5 +948,5 @@
     // XXX need to validate that this coresponds to an warpInputImfile
     if (!warpSkyfileInsert(config->dbh,
-            (psS32)atoi(warp_id),
+            (psS64)atoll(warp_id),
             skycell_id,
             tess_id,
@@ -1125,4 +1155,10 @@
 
     if (psArrayLength(output)) {
+        if (!convertIdToStr(output)) {
+            psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");
+            psFree(output);
+            return false;
+        }
+
         // negative simple so the default is true
         if (!ippdbPrintMetadatas(stdout, output, "warpSkyfile", !simple)) {
Index: trunk/ippTools/src/warptoolConfig.c
===================================================================
--- trunk/ippTools/src/warptoolConfig.c	(revision 12123)
+++ trunk/ippTools/src/warptoolConfig.c	(revision 12131)
@@ -60,5 +60,5 @@
     psMetadata *updaterunArgs = psMetadataAlloc();
     psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-warp_id", 0,
-            "define warp ID (required)", NULL);
+            "define warptool ID (required)", NULL);
     psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-state", 0,
             "set state (required)", NULL);
@@ -73,9 +73,7 @@
     psMetadata *addinputexpArgs = psMetadataAlloc();
     psMetadataAddStr(addinputexpArgs, PS_LIST_TAIL, "-warp_id", 0,
-            "define warp ID (required)", NULL);
-    psMetadataAddStr(addinputexpArgs, PS_LIST_TAIL, "-exp_tag", 0,
-            "define exposure tag (required)", NULL);
-    psMetadataAddS32(addinputexpArgs, PS_LIST_TAIL, "-cam_version", 0,
-            "define phase 3 version of exposure tag (required)", 0);
+            "define warptool ID (required)", NULL);
+    psMetadataAddStr(addinputexpArgs, PS_LIST_TAIL, "-cam_id", 0,
+            "define camtool ID (required)", NULL);
     psMetadataAddBool(addinputexpArgs, PS_LIST_TAIL, "-magiced",  0,
             "has this exposure been magiced", false);
@@ -84,9 +82,7 @@
     psMetadata *expArgs = psMetadataAlloc();
     psMetadataAddStr(expArgs, PS_LIST_TAIL, "-warp_id", 0,
-            "define warp ID (required)", NULL);
-    psMetadataAddStr(expArgs, PS_LIST_TAIL, "-exp_tag", 0,
-            "define exposure tag (required)", NULL);
-    psMetadataAddS32(expArgs, PS_LIST_TAIL, "-cam_version", 0,
-            "define phase 3 version of exposure tag (required)", 0);
+            "search by warptool ID", NULL);
+    psMetadataAddStr(expArgs, PS_LIST_TAIL, "-cam_id", 0,
+            "search by camtool ID", NULL);
     psMetadataAddU64(expArgs, PS_LIST_TAIL, "-limit",  0,
             "limit result set to N items", 0);
@@ -97,9 +93,7 @@
     psMetadata *imfileArgs = psMetadataAlloc();
     psMetadataAddStr(imfileArgs, PS_LIST_TAIL, "-warp_id", 0,
-            "define warp ID (required)", NULL);
-    psMetadataAddStr(imfileArgs, PS_LIST_TAIL, "-exp_tag", 0,
-            "define exposure tag (required)", NULL);
-    psMetadataAddS32(imfileArgs, PS_LIST_TAIL, "-cam_version", 0,
-            "define phase 3 version of exposure tag (required)", 0);
+            "search by warptool ID", NULL);
+    psMetadataAddStr(imfileArgs, PS_LIST_TAIL, "-cam_id", 0,
+            "search by camtool ID", NULL);
     psMetadataAddU64(imfileArgs, PS_LIST_TAIL, "-limit",  0,
             "limit result set to N items", 0);
@@ -119,10 +113,10 @@
     psMetadata *addoverlapArgs = psMetadataAlloc();
     psMetadataAddStr(addoverlapArgs, PS_LIST_TAIL, "-mapfile", 0,
-            "skycell <-> imfile mapping description", NULL);
+            "path to skycell <-> imfile mapping file", NULL);
 
     // -scmap
     psMetadata *scmapArgs = psMetadataAlloc();
     psMetadataAddStr(scmapArgs, PS_LIST_TAIL, "-warp_id", 0,
-            "search by warp ID", NULL);
+            "search by warptool ID", NULL);
     psMetadataAddStr(scmapArgs, PS_LIST_TAIL, "-skycell_id", 0,
             "searcy by skycell ID", NULL);
@@ -137,5 +131,5 @@
     psMetadata *towarpedArgs = psMetadataAlloc();
     psMetadataAddStr(towarpedArgs, PS_LIST_TAIL, "-warp_id", 0,
-            "search by warp ID", NULL);
+            "search by warptool ID", NULL);
     psMetadataAddU64(towarpedArgs, PS_LIST_TAIL, "-limit",  0,
             "limit result set to N items", 0);
@@ -146,5 +140,5 @@
     psMetadata *addwarpedArgs = psMetadataAlloc();
     psMetadataAddStr(addwarpedArgs, PS_LIST_TAIL, "-warp_id", 0,
-            "define warp ID (required)", NULL);
+            "define warptool ID (required)", NULL);
     psMetadataAddStr(addwarpedArgs, PS_LIST_TAIL, "-skycell_id",  0,
             "define skycell ID (required)", NULL);
@@ -161,5 +155,5 @@
     psMetadata *warpedArgs = psMetadataAlloc();
     psMetadataAddStr(warpedArgs, PS_LIST_TAIL, "-warp_id", 0,
-            "search by warp ID", NULL);
+            "search by warptool ID", NULL);
     psMetadataAddStr(warpedArgs, PS_LIST_TAIL, "-skycell_id",  0,
             "define skycell ID (required)", NULL);
@@ -168,6 +162,6 @@
     psMetadataAddStr(warpedArgs, PS_LIST_TAIL, "-exp_tag", 0,
             "define exposure tag (required)", NULL);
-    psMetadataAddS32(warpedArgs, PS_LIST_TAIL, "-cam_version", 0,
-            "define phase 3 version of exposure tag (required)", 0);
+    psMetadataAddStr(warpedArgs, PS_LIST_TAIL, "-cam_id", 0,
+            "define phase 3 version of exposure tag (required)", NULL);
     psMetadataAddU64(warpedArgs, PS_LIST_TAIL, "-limit",  0,
             "limit result set to N items", 0);
@@ -286,5 +280,5 @@
     bool status = false;
     if ((str = psMetadataLookupStr(&status, config->args, "-warp_id"))) {
-        if (!psMetadataAddS32(config->where, PS_LIST_TAIL, "warp_id", 0, "==", (psS32)atoi(str))) {
+        if (!psMetadataAddS64(config->where, PS_LIST_TAIL, "warp_id", 0, "==", (psS64)atoll(str))) {
             psError(PS_ERR_UNKNOWN, false, "failed to add item warp_id");
             psFree(config);
