Index: trunk/ippTools/src/pztool.c
===================================================================
--- trunk/ippTools/src/pztool.c	(revision 15032)
+++ trunk/ippTools/src/pztool.c	(revision 15062)
@@ -28,4 +28,5 @@
 
 #include "pxtools.h"
+#include "pxdata.h"
 #include "pztool.h"
 
@@ -217,11 +218,9 @@
     }
 
-    psString query = psStringCopy(
-            "SELECT"
-            "   summitImfile.*"
-            " FROM pzPendingImfile"
-            " JOIN summitImfile"
-            "   USING(exp_name, camera, telescope, class, class_id)"
-        );
+    psString query = pxDataGet("pztool_pendingimfile.sql");
+    if (!query) {
+        psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");
+        return false;
+    }
 
     if (config->where) {
