Index: trunk/ippTools/scripts/regtest.sh
===================================================================
--- trunk/ippTools/scripts/regtest.sh	(revision 14035)
+++ trunk/ippTools/scripts/regtest.sh	(revision 14037)
@@ -8,5 +8,5 @@
 echo -e "YES\nipp\n\n" | pxadmin -recreate || exit 1
 
-exp_id1=`$inject -newExp -tmp_exp_name t10 -tmp_inst gpc -tmp_telescope ps1 -imfiles 4 -workdir file::///some/path -simple` || exit 1
+exp_id1=`$inject -newExp -tmp_exp_name t10 -tmp_inst gpc -tmp_telescope ps1 -workdir file::///some/path -simple` || exit 1
 
 for ID in `seq 0 3`; do
@@ -16,5 +16,5 @@
 $inject -updatenewExp -exp_id $exp_id1 -state run
 
-exp_id2=`$inject -newExp -tmp_exp_name t11 -tmp_inst gpc -tmp_telescope ps1 -imfiles 4 -workdir file::///some/path -simple` || exit 1
+exp_id2=`$inject -newExp -tmp_exp_name t11 -tmp_inst gpc -tmp_telescope ps1 -workdir file::///some/path -simple` || exit 1
 
 for ID in `seq 0 3`; do
@@ -23,4 +23,5 @@
 
 $inject -updatenewExp -exp_id $exp_id2 -state run
+
 
 $regtool -pendingimfile || exit 1
Index: trunk/ippTools/share/regtool_pendingexp.sql
===================================================================
--- trunk/ippTools/share/regtool_pendingexp.sql	(revision 14035)
+++ trunk/ippTools/share/regtool_pendingexp.sql	(revision 14037)
@@ -1,5 +1,7 @@
 SELECT DISTINCT * FROM
     (SELECT
-       newExp.*
+       newExp.*,
+       newImfile.tmp_class_id,
+       rawImfile.tmp_class_id as raw_tmp_class_id
     FROM newExp
     JOIN newImfile
@@ -7,8 +9,13 @@
     LEFT JOIN rawExp
        USING(exp_id)
+    LEFT JOIN rawImfile
+        ON newImfile.exp_id = rawImfile.exp_id
+        AND newImfile.tmp_class_id = rawImfile.tmp_class_id
     WHERE
         newExp.state = 'run'
         AND rawExp.exp_id IS NULL
-        AND newExp.imfiles =
-        (SELECT COUNT(exp_id) FROM rawImfile
-            WHERE rawImfile.exp_id = newExp.exp_id)) as Foo
+    GROUP BY
+        newExp.exp_id
+    HAVING
+        COUNT(newImfile.tmp_class_id) = COUNT(rawImfile.tmp_class_id)
+    ) as Foo
Index: trunk/ippTools/src/pxinject.c
===================================================================
--- trunk/ippTools/src/pxinject.c	(revision 14035)
+++ trunk/ippTools/src/pxinject.c	(revision 14037)
@@ -107,13 +107,4 @@
         return false;
     }
-    psS32 imfiles = psMetadataLookupS32(&status, config->args, "-imfiles");
-    if (!status) {
-        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -imfiles");
-        return false;
-    }
-    if (!imfiles) {
-        psError(PS_ERR_UNKNOWN, true, "-imfiles is required");
-        return false;
-    }
 
     psString workdir = psMetadataLookupStr(&status, config->args, "-workdir");
@@ -130,8 +121,7 @@
                 0x0, // exp_id
                 tmp_exp_name,
-                "reg", // state
                 tmp_camera,
                 tmp_telescope,
-                imfiles,
+                "reg", // state
                 workdir,
                 "dirty"
Index: trunk/ippTools/src/pxinjectConfig.c
===================================================================
--- trunk/ippTools/src/pxinjectConfig.c	(revision 14035)
+++ trunk/ippTools/src/pxinjectConfig.c	(revision 14037)
@@ -51,6 +51,4 @@
     psMetadataAddStr(newExpArgs, PS_LIST_TAIL, "-tmp_telescope",  0,
             "define the telescope name (required)", NULL);
-    psMetadataAddS32(newExpArgs, PS_LIST_TAIL, "-imfiles",  0,
-            "define the number of imfiles in this exp (required)", 0);
     psMetadataAddStr(newExpArgs, PS_LIST_TAIL, "-workdir",  0,
             "define workdir (required)", 0);
@@ -62,8 +60,4 @@
     psMetadataAddStr(newImfileArgs, PS_LIST_TAIL, "-exp_id",  0,
             "define the exp_id (required)", NULL);
-#if 0
-    psMetadataAddStr(newImfileArgs, PS_LIST_TAIL, "-class",  0,
-            "define the class (required)", NULL);
-#endif
     psMetadataAddStr(newImfileArgs, PS_LIST_TAIL, "-tmp_class_id",  0,
             "define the class ID (required)", NULL);
