Index: branches/eam_branch_00/ippTasks/phase0.pro
===================================================================
--- branches/eam_branch_00/ippTasks/phase0.pro	(revision 11059)
+++ branches/eam_branch_00/ippTasks/phase0.pro	(revision 11085)
@@ -1,4 +1,4 @@
 ## this file contains the tasks for running the phase 0 stage
-## these tasks use the books Phase0Imfiles and Phase0Exposures
+## these tasks use the books p0PendingImfile and p0PendingExp
 
 if ($?network == 0)
@@ -20,14 +20,14 @@
 exec mkdir -p $LOGSUBDIR
 
-book init Phase0Imfiles
-book init Phase0Exposures
+book init p0PendingImfile
+book init p0PendingExp
 
 macro phase0.status
-  book listbook Phase0Imfiles
-  book listbook Phase0Exposures
+  book listbook p0PendingImfile
+  book listbook p0PendingExp
 end
 
 # select images ready for phase0 analysis
-# new entries are added to Phase0Imfiles
+# new entries are added to p0PendingImfile
 # compare the new list with the ones already selected
 task	       phase0.imfile.load
@@ -49,12 +49,12 @@
   task.exit    $EXIT_SUCCESS
     # convert 'stdout' to book format
-    ipptool2book stdout Phase0Imfiles -key exp_tag -uniq
+    ipptool2book stdout p0PendingImfile -key exp_tag -uniq
     if ($VERBOSE > 2)
-      book listbook Phase0Imfiles
-    end
-
-    # delete existing entries which are DONE
-    book delpage Phase0Imfiles -key state DONE
-    echo "p0tool -pendingimfile dtime: $JOB_DTIME"
+      book listbook p0PendingImfile
+    end
+
+    # delete existing entries which are DONE or DATAERR
+    book delpage p0PendingImfile -key state DONE
+    book delpage p0PendingImfile -key state DATA_ERR
   end
 
@@ -77,20 +77,20 @@
 
   task.exec
-    book npages Phase0Imfiles -var N
+    book npages p0PendingImfile -var N
     if ($N == 0) break
     if ($network == 0) break
     
-    # look for new images in Phase0Imfiles
-    book getpage Phase0Imfiles 0 -var pageName -key state NULL
+    # look for new images in p0PendingImfile
+    book getpage p0PendingImfile 0 -var pageName -key state NULL
     if ($pageName == NULL) break
 
-    book setword Phase0Imfiles $pageName state RUN
-    # Phase0Imfiles->pageName->state = RUN
-
-    book getword Phase0Imfiles $pageName exp_tag -var EXP_TAG
-    # $EXP_TAG = Phase0Imfiles->pageName->exp_tag
-    book getword Phase0Imfiles $pageName class -var CLASS
-    book getword Phase0Imfiles $pageName class_id -var CLASS_ID
-    book getword Phase0Imfiles $pageName uri -var URI
+    book setword p0PendingImfile $pageName state RUN
+    # p0PendingImfile->pageName->state = RUN
+
+    book getword p0PendingImfile $pageName exp_tag -var EXP_TAG
+    # $EXP_TAG = p0PendingImfile->pageName->exp_tag
+    book getword p0PendingImfile $pageName class -var CLASS
+    book getword p0PendingImfile $pageName class_id -var CLASS_ID
+    book getword p0PendingImfile $pageName uri -var URI
 
     # specify choice of remote host
@@ -120,20 +120,12 @@
 
   # success
-  task.exit 0
-    # phase0_imfile.pl updates DB tables, here we just update the page
-    book setword Phase0Imfiles $options:0 state DONE
-    # equiv to: Phase0Imfiles->pageName->state = DONE
-  end
-
-  # default exit status
-  task.exit    default
-    showcommand failure
-    book setword Phase0Imfiles $options:0 state FAIL
-  end
-
-  # operation times out?
-  task.exit    timeout
-    showcommand timeout
-    book setword Phase0Imfiles $options:0 state TIMEOUT
+  task.exit default
+    process_exit p0PendingImfile $options:0 $JOB_STATUS
+  end
+
+  # operation timed out?
+  task.exit    timeout
+    showcommand timeout
+    book setword p0PendingImfile $options:0 state TIMEOUT
   end
 end
@@ -157,12 +149,12 @@
   task.exit    0
     # convert 'stdout' to book format
-    ipptool2book stdout Phase0Exposures -key exp_tag -uniq
+    ipptool2book stdout p0PendingExp -key exp_tag -uniq
     if ($VERBOSE > 2)
-      book listbook Phase0Exposures
+      book listbook p0PendingExp
     end
 
     # delete existing entries which are DONE
-    book delpage Phase0Exposures -key state DONE
-    echo "p0tool -pendingexp dtime: $JOB_DTIME"
+    book delpage p0PendingExp -key state DONE
+    book delpage p0PendingExp -key state DATA_ERR
   end
 
@@ -185,14 +177,14 @@
 
   task.exec
-    book npages Phase0Exposures -var N
+    book npages p0PendingExp -var N
     if ($N == 0) break
     if ($network == 0) break
     
-    # look for new images in Phase0Exposures (state == NULL)
-    book getpage Phase0Exposures 0 -var pageName -key state NULL
+    # look for new images in p0PendingExp (state == NULL)
+    book getpage p0PendingExp 0 -var pageName -key state NULL
     if ($pageName == NULL) break
 
-    book setword Phase0Exposures $pageName state RUN
-    book getword Phase0Exposures $pageName exp_tag -var EXP_TAG
+    book setword p0PendingExp $pageName state RUN
+    book getword p0PendingExp $pageName exp_tag -var EXP_TAG
 
     # specify choice of remote host:(need to choose based on chips)
@@ -222,13 +214,6 @@
 
   # success
-  task.exit 0
-    # phase0exp.pl updates DB tables, here we just update the page
-    book setword Phase0Exposures $options:0 state DONE
-  end
-
-  # default exit status
-  task.exit    default
-    showcommand failure
-    book setword Phase0Exposures $options:0 state FAIL
+  task.exit default
+    process_exit p0PendingExp $options:0 $JOB_STATUS
   end
 
@@ -236,5 +221,5 @@
   task.exit    timeout
     showcommand timeout
-    book setword Phase0Exposures $options:0 state TIMEOUT
+    book setword p0PendingExp $options:0 state TIMEOUT
   end
 end
