Index: /branches/eam_branch_00/ippTasks/phase0.pro
===================================================================
--- /branches/eam_branch_00/ippTasks/phase0.pro	(revision 11208)
+++ /branches/eam_branch_00/ippTasks/phase0.pro	(revision 11209)
@@ -27,4 +27,6 @@
   book listbook p0PendingExp
 end
+
+$phase0_DB = 0
 
 # select images ready for phase0 analysis
@@ -45,10 +47,18 @@
   stderr $LOGSUBDIR/phase0.imfile.log
 
-  task.exec
-    command p0tool -pendingimfile -limit 20
+  # select entries from the current DB; cycle to the next DB, if it exists
+  # if the DB list is not set, use the value defined in .ipprc
+  task.exec
+    if ($DB:n == 0)
+      command p0tool -pendingimfile -limit 20
+    else
+      command p0tool -pendingimfile -limit 20 -dbname $DB:$phase0_DB
+      $phase0_DB ++
+      if ($phase0_DB >= $DB:n) set phase0_DB = 0
+    end
   end
 
   # success
-  task.exit    $EXIT_SUCCESS
+  task.exit $EXIT_SUCCESS
     # convert 'stdout' to book format
     ipptool2book stdout p0PendingImfile -key exp_tag -uniq
@@ -95,4 +105,5 @@
     book getword p0PendingImfile $pageName uri -var URI
     book getword p0PendingImfile $pageName outpath -var OUTPATH
+    book getword p0PendingImfile $pageName dbname -var DBNAME
 
     # specify choice of remote host
@@ -115,7 +126,7 @@
     # create the command line
     if ($VERBOSE > 1)
-      echo command phase0_imfile.pl --exp_tag $EXP_TAG --class_id $CLASS_ID --uri $URI
-    end
-    command phase0_imfile.pl --exp_tag $EXP_TAG --class_id $CLASS_ID --uri $URI
+      echo command phase0_imfile.pl --exp_tag $EXP_TAG --class_id $CLASS_ID --uri $URI --dbname $DBNAME
+    end
+    command phase0_imfile.pl --exp_tag $EXP_TAG --class_id $CLASS_ID --uri $URI --dbname $DBNAME
   end
 
