Index: /trunk/ippTools/src/pzgetexp.c
===================================================================
--- /trunk/ippTools/src/pzgetexp.c	(revision 15090)
+++ /trunk/ippTools/src/pzgetexp.c	(revision 15091)
@@ -68,10 +68,32 @@
 {
     PS_ASSERT_PTR_NON_NULL(config, NULL);
+
+    bool status = false;
+    psString camera = psMetadataLookupStr(&status, config->args, "-inst");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -inst");
+        return false;
+    }
+    if (!camera) {
+        psError(PS_ERR_UNKNOWN, true, "-inst is required");
+        return false;
+    }
+
+    psString telescope = psMetadataLookupStr(&status, config->args, "-telescope");
+    if (!status) {
+        psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -telescope");
+        return false;
+    }
+    if (!telescope) {
+        psError(PS_ERR_UNKNOWN, true, "-telescope is required");
+        return false;
+    }
+
     // find last fileset/exp_name (if we have one)
     bool haveLastFileSet = false;
     psString lastFileSet = NULL;
     {
-        char *query = "SELECT * from summitExp ORDER BY dateobs DESC LIMIT 1";
-        if (!p_psDBRunQuery(config->dbh, query)) {
+        char *query = "SELECT * from summitExp WHERE camera = \"%s\" and TELESCOPE = \"%s\" ORDER BY dateobs DESC LIMIT 1";
+        if (!p_psDBRunQuery(config->dbh, query, camera, telescope)) {
             psError(PS_ERR_UNKNOWN, false, "database error");
             return false;
@@ -97,5 +119,4 @@
     // invoke dsproductls
     // dsproductls --uri <> --last_fileset <>
-    bool status = false;
     psString uri = psMetadataLookupStr(&status, config->args, "-uri");
     psString cmd = NULL;
