Index: trunk/ippTasks/chip.pro
===================================================================
--- trunk/ippTasks/chip.pro	(revision 17608)
+++ trunk/ippTasks/chip.pro	(revision 17624)
@@ -137,9 +137,12 @@
     set.host.for.camera $CAMERA $CLASS_ID
 
-    # raw workdir examples:
+    # set the WORKDIR variable
+    set.workdir.by.camera $CAMERA $CLASS_ID $WORKDIR_TEMPLATE $default_host WORKDIR
+
+    # notes on how this works:
+    # -- raw workdir examples:
     # file://data/@HOST@.0/gpc1/20080130
     # neb:///@HOST@-vol0/gpc1/20080130 (need to supply volname?, or are we re-defining this each time?)
-    set.workdir.by.camera $CAMERA $CLASS_ID $WORKDIR_TEMPLATE $default_host WORKDIR
-    # out workdir examples:
+    # -- out workdir examples:
     # file://data/ipp004.0/gpc1/20080130
     # neb:///ipp004-vol0/gpc1/20080130
Index: trunk/ippTasks/detrend.correct.pro
===================================================================
--- trunk/ippTasks/detrend.correct.pro	(revision 17608)
+++ trunk/ippTasks/detrend.correct.pro	(revision 17624)
@@ -134,5 +134,5 @@
     book getword detPendingCorrectedImfile $pageName corr_id   -var CORR_ID
     book getword detPendingCorrectedImfile $pageName corr_type -var CORR_TYPE
-    book getword detPendingCorrectedImfile $pageName workdir   -var WORKDIR
+    book getword detPendingCorrectedImfile $pageName workdir   -var WORKDIR_TEMPLATE
     book getword detPendingCorrectedImfile $pageName dbname    -var DBNAME
 
@@ -140,20 +140,22 @@
     set.host.for.camera $CAMERA $CLASS_ID
 
-    ## output log filename
-    if ("$WORKDIR" == "NULL")
-      $outpath = `pwd`
-    else
-      $outpath = `ipp_datapath.pl $WORKDIR`
-    end
-    sprintf outpath "%s/%s.%s.%s/%s" $outpath $CAMERA $DET_TYPE $DET_ID $EXP_TAG
-    sprintf outroot "%s/%s.detcorr.%s" $outpath $EXP_TAG $DET_ID
+    # set the WORKDIR variable
+    set.workdir.by.camera $CAMERA $CLASS_ID $WORKDIR_TEMPLATE $default_host WORKDIR
+
+    ## generate outroot specific to this exposure (& chip)
+    sprintf outroot "%s/%s.%s.%s/%s/%s.detcorr.%s" $WORKDIR $CAMERA $DET_TYPE $DET_ID $EXP_TAG $EXP_TAG $DET_ID
+
     $logfile = `ipp_filename.pl --filerule LOG.IMFILE --camera $CAMERA --class_id $CLASS_ID --basename $outroot`
     if ("$logfile" == "") 
-      sprintf logfile "%s.%s.log" $outroot $CLASS_ID
+      echo "WARNING: logfile not defined in detrend.correct.pro:150"
+      break
     end
 
     stdout $logfile
     stderr $logfile
-    exec mkdir -p $outpath
+    dirname $logfile -var outpath
+
+    # XXX I need to report the error if this fails...
+    mkdir $outpath
 
     $run = detrend_correct_imfile.pl --det_id $DET_ID --exp_id $EXP_ID --class_id $CLASS_ID --exp_tag $EXP_TAG --input_uri $URI --corr_id $CORR_ID --corr_type $CORR_TYPE --camera $CAMERA
@@ -261,5 +263,5 @@
     book getword detPendingCorrectedExp $pageName corr_id   -var CORR_ID
     book getword detPendingCorrectedExp $pageName corr_type -var CORR_TYPE
-    book getword detPendingCorrectedExp $pageName workdir   -var WORKDIR
+    book getword detPendingCorrectedExp $pageName workdir   -var WORKDIR_TEMPLATE
     book getword detPendingCorrectedExp $pageName dbname    -var DBNAME
 
@@ -267,12 +269,11 @@
     set.host.for.camera $camera FPA
 
-    # XXX push this into the filerules?
-    if ("$WORKDIR" == "NULL")
-      $outpath = `pwd`
-    else
-      $outpath = `ipp_datapath.pl $WORKDIR`
-    end
-    sprintf outpath "%s/%s.%s.%s/%s" $outpath $CAMERA $DET_TYPE $DET_ID $EXP_TAG
-    sprintf outroot "%s/%s.detcorr.%s" $outpath $EXP_TAG $DET_ID
+    # set workdir (interpolate host; see camera.pro for examples)
+    set.workdir.by.camera $CAMERA FPA $WORKDIR_TEMPLATE $default_host WORKDIR
+
+    ## generate outroot specific to this exposure (& chip)
+    sprintf outroot "%s/%s.%s.%s/%s/%s.detcorr.%s" $WORKDIR $CAMERA $DET_TYPE $DET_ID $EXP_TAG $EXP_TAG $DET_ID
+
+    ## generate output log based on filerule (convert the URI to a PATH)
     $logfile = `ipp_filename.pl --filerule LOG.EXP --camera $CAMERA --class_id NONE --basename $outroot`
     if ("$logfile" == "") 
@@ -282,5 +283,6 @@
     stdout $logfile
     stderr $logfile
-    exec mkdir -p $outpath
+    dirname $logfile -var outpath
+    mkdir $outpath
 
     $run = detrend_correct_exp.pl --det_id $DET_ID --exp_id $EXP_ID --exp_tag $EXP_TAG --det_type $DET_TYPE --camera $CAMERA --corr_id $CORR_ID --corr_type $CORR_TYPE --camera $CAMERA
Index: trunk/ippTasks/detrend.norm.pro
===================================================================
--- trunk/ippTasks/detrend.norm.pro	(revision 17608)
+++ trunk/ippTasks/detrend.norm.pro	(revision 17624)
@@ -155,5 +155,5 @@
 
     ## generate output log
-    $logfile = `ipp_filename.pl --filerule LOG.EXP --camera $CAMERA --basename $outroot --class_id fpa`
+    $logfile = `ipp_filename.pl --filerule LOG.EXP --camera $CAMERA --class_id NONE --basename $outroot`
 
     stdout $logfile
@@ -388,5 +388,5 @@
 
     ## generate output log (NOT based on filerule?)
-    $logfile = `ipp_filename.pl --filerule LOG.EXP --camera $CAMERA --basename $outroot --class_id fpa`
+    $logfile = `ipp_filename.pl --filerule LOG.EXP --camera $CAMERA --class_id NONE --basename $outroot`
 
     stdout $logfile
Index: trunk/ippTasks/detrend.reject.pro
===================================================================
--- trunk/ippTasks/detrend.reject.pro	(revision 17608)
+++ trunk/ippTasks/detrend.reject.pro	(revision 17624)
@@ -124,6 +124,9 @@
 
     ## generate output log based on filerule (convert the URI to a PATH)
-    $logfile = $outroot.log
-    $logfile = `ipp_datapath.pl $logfile`
+    $logfile = `ipp_filename.pl --filerule LOG.EXP --camera $CAMERA --class_id NONE --basename $outroot`
+    if ("$logfile" == "") 
+      echo "WARNING: logfile not defined in detrend.reject.pro:282"
+      break
+    end
 
     stdout $logfile
Index: trunk/ippTasks/register.pro
===================================================================
--- trunk/ippTasks/register.pro	(revision 17608)
+++ trunk/ippTasks/register.pro	(revision 17624)
@@ -140,15 +140,25 @@
     set.host.for.camera $TMP_CAMERA $TMP_CLASS_ID 
 
-    # raw workdir examples:
+    # set the WORKDIR variable
+    set.workdir.by.camera $TMP_CAMERA $TMP_CLASS_ID $WORKDIR_TEMPLATE $default_host WORKDIR
+
+    # notes on how this works:
+    # -- raw workdir examples:
     # file://data/@HOST@.0/gpc1/20080130
     # neb:///@HOST@-vol0/gpc1/20080130 (need to supply volname?, or are we re-defining this each time?)
-    set.workdir.by.camera $TMP_CAMERA $TMP_CLASS_ID $WORKDIR_TEMPLATE $default_host WORKDIR
-    # out workdir examples:
+    # -- out workdir examples:
     # file://data/ipp004.0/gpc1/20080130
     # neb:///ipp004-vol0/gpc1/20080130
 
-    ## generate output logfile name and convert URI to a PATH
-    sprintf logfile "%s/%s/%s.%s.reg.log" $WORKDIR $EXP_TAG $EXP_TAG $TMP_CLASS_ID
+    ## generate outroot specific to this exposure (& chip)
+    sprintf logfile "%s/%s/%s.reg.%s.log" $WORKDIR $EXP_TAG $EXP_TAG $TMP_CLASS_ID
+
+    ## generate output log based on filerule (convert the URI to a PATH)
+    ## note that we use ipp_datapath here not ipp_filename because the CAMERA name is not yet controlled
     $logfile = `ipp_datapath.pl $logfile`
+    if ("$logfile" == "") 
+      echo "WARNING: logfile not defined in register.pro:160"
+      break
+    end
 
     stdout $logfile
@@ -261,9 +271,12 @@
     set.host.for.camera $TMP_CAMERA $TMP_CLASS_ID 
 
-    # raw workdir examples:
+    # set the WORKDIR variable
+    set.workdir.by.camera $TMP_CAMERA $TMP_CLASS_ID $WORKDIR_TEMPLATE $default_host WORKDIR
+
+    # notes on how this works:
+    # -- raw workdir examples:
     # file://data/@HOST@.0/gpc1/20080130
     # neb:///@HOST@-vol0/gpc1/20080130 (need to supply volname?, or are we re-defining this each time?)
-    set.workdir.by.camera $TMP_CAMERA $TMP_CLASS_ID $WORKDIR_TEMPLATE $default_host WORKDIR
-    # out workdir examples:
+    # -- out workdir examples:
     # file://data/ipp004.0/gpc1/20080130
     # neb:///ipp004-vol0/gpc1/20080130
@@ -271,5 +284,12 @@
     ## generate output log based on filerule
     sprintf logfile "%s/%s/%s.reg.log" $WORKDIR $EXP_TAG $EXP_TAG
+
+    ## generate output log based on filerule (convert the URI to a PATH)
+    ## note that we use ipp_datapath here not ipp_filename because the CAMERA name is not yet controlled
     $logfile = `ipp_datapath.pl $logfile`
+    if ("$logfile" == "") 
+      echo "WARNING: logfile not defined in register.pro:291"
+      break
+    end
 
     stdout $logfile
Index: trunk/ippTasks/stack.pro
===================================================================
--- trunk/ippTasks/stack.pro	(revision 17608)
+++ trunk/ippTasks/stack.pro	(revision 17624)
@@ -128,7 +128,11 @@
     sprintf outroot "%s/tess_%s/%s/%s.%s.stk.%s" $WORKDIR $TESS_ID $SKYCELL_ID $TESS_ID $SKYCELL_ID $STACK_ID
 
-    ## generate output log based on filerule (convert the URI to a PATH)
+    ## generate output log based on filerule (convert the URI to a PATH) (use STACK_ID?)
 #    $logfile = `ipp_filename.pl --filerule LOG.EXP --camera $CAMERA --class_id $STACK_ID --basename $outroot`
-    $logfile = `ipp_datapath.pl $outroot.pantasks.log`
+    $logfile = `ipp_filename.pl --filerule LOG.EXP --camera $CAMERA --class_id NONE --basename $outroot`
+    if ("$logfile" == "") 
+      echo "WARNING: logfile not defined in stack.pro:136"
+      break
+    end
 
     stdout $logfile
