Index: trunk/ippTools/src/p2searchPendingFrames.c
===================================================================
--- trunk/ippTools/src/p2searchPendingFrames.c	(revision 6133)
+++ trunk/ippTools/src/p2searchPendingFrames.c	(revision 6156)
@@ -18,4 +18,18 @@
     }
     /*
+    if (config->exp_id != NULL) {
+        psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", 0, "==",
+            config->exp_id);
+    }
+    if (config->class != NULL) {
+        psMetadataAddStr(where, PS_LIST_TAIL, "class", 0, "==",
+            config->class);
+    }
+    if (config->class_id != NULL) {
+        psMetadataAddStr(where, PS_LIST_TAIL, "class_id", 0, "==",
+            config->class_id);
+    }
+    */
+    /*
     if (!psTimeIsZero(config->start) && !psTimeIsZero(config->stop)) {
         psMetadataAddTime(where, PS_LIST_TAIL, "TIME_START", 0, "<", config->stop);
@@ -26,4 +40,9 @@
     psArray *exposures = p2PendingExpSelectRowObjects(config->database, where, MAX_ROWS);
     psFree(where);
+    if (!exposures) {
+        psError(PS_ERR_UNKNOWN, false, "no p2PendingExp rows found");
+        return NULL;
+    }
+
 
     // output array of rawSet
@@ -52,2 +71,39 @@
 // which have the appropriate state.  that would limit the ability to filter
 // the selection.  test to see how well/poorly this performs
+
+psArray *p2searchPendingImfiles(p2Config *config)
+{
+    PS_ASSERT_PTR_NON_NULL(config, NULL);
+
+    psMetadata *where = psMetadataAlloc();
+    if (config->camera_name != NULL) {
+        if (!psMetadataAddStr(where, PS_LIST_TAIL, "camera", 0, "==",
+            config->camera_name)) {
+            psError(PS_ERR_UNKNOWN, false, "failed to add item camera");
+            psFree(where);
+            return NULL;
+        }
+    }
+    if (config->filter != NULL) {
+        psMetadataAddStr(where, PS_LIST_TAIL, "filter", 0, "==",
+            config->filter);
+    }
+    if (config->exp_id != NULL) {
+        psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", 0, "==",
+            config->exp_id);
+    }
+    if (config->class != NULL) {
+        psMetadataAddStr(where, PS_LIST_TAIL, "class", 0, "==",
+            config->class);
+    }
+    if (config->class_id != NULL) {
+        psMetadataAddStr(where, PS_LIST_TAIL, "class_id", 0, "==",
+            config->class_id);
+    }
+
+    psArray *imfiles = p2PendingImfileSelectRowObjects(config->database, where,
+        MAX_ROWS);
+    psFree(where);
+
+    return imfiles;
+}
