Index: /trunk/ippScripts/scripts/camera_exp.pl
===================================================================
--- /trunk/ippScripts/scripts/camera_exp.pl	(revision 16195)
+++ /trunk/ippScripts/scripts/camera_exp.pl	(revision 16196)
@@ -37,5 +37,5 @@
 use Pod::Usage qw( pod2usage );
 
-my ($exp_tag, $cam_id, $recipe, $camera, $dbname, $workdir, $reduction, $dvodb, $no_update, $no_op);
+my ($exp_tag, $cam_id, $camera, $outroot, $recipe, $dbname, $reduction, $dvodb, $no_update, $no_op);
 GetOptions(
 	   'exp_tag=s'          => \$exp_tag, # Exposure identifier
@@ -44,5 +44,5 @@
 	   'camera|c=s'        => \$camera, # Camera
 	   'dbname|d=s'        => \$dbname, # Database name
-	   'workdir|w=s'       => \$workdir, # Working directory
+	   'outroot|w=s'       => \$outroot, # output file base name
 	   'reduction=s'       => \$reduction, # Reduction class		       
 	   'dvodb|w=s'         => \$dvodb,  # output DVO database
@@ -55,7 +55,9 @@
 	  -msg => "Required options: --exp_tag --cam_id --camera",
 	  -exitval => 3,
-	  ) unless defined $exp_tag
-    and defined $cam_id
-    and defined $camera;
+	  ) unless 
+    defined $exp_tag and
+    defined $cam_id and
+    defined $outroot and
+    defined $camera;
 
 $ipprc->define_camera($camera);
@@ -136,4 +138,5 @@
 }
 
+### not needed to have such an extensive temp file name.
 my ($list1File, $list1Name) = tempfile( "$exp_tag.cm.$cam_id.b1.list.XXXX", UNLINK => 1 ); # For binning 1
 my ($list2File, $list2Name) = tempfile( "$exp_tag.cm.$cam_id.b2.list.XXXX", UNLINK => 1 ); # For binning 2
@@ -162,13 +165,11 @@
 
 # Output products
-$workdir = caturi( $workdir, $exp_tag ) if defined $workdir;
-my $outputRoot = $ipprc->file_prepare( "$exp_tag.cm.$cam_id", $workdir, ${$files}[0]->{path_base} );
-
-my $jpeg1      = $ipprc->filename("PPIMAGE.JPEG1", $outputRoot); # Binned JPEG #1
-my $jpeg2      = $ipprc->filename("PPIMAGE.JPEG2", $outputRoot); # Binned JPEG #2
-my $fpaObjects = $ipprc->filename("PSASTRO.OUTPUT.MEF", $outputRoot); # MEF psastro output
-
-my $traceDest = 'file:' . $ipprc->file_resolve($outputRoot) . ".trace"; # Trace messages
-my $logDest = 'file:' . $ipprc->file_resolve($outputRoot) . ".log"; # Log messages
+$ipprc->outroot_prepare($outroot);
+
+my $jpeg1      = $ipprc->filename("PPIMAGE.JPEG1", 	$outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR);
+my $jpeg2      = $ipprc->filename("PPIMAGE.JPEG2", 	$outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR);
+my $fpaObjects = $ipprc->filename("PSASTRO.OUTPUT.MEF", $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR);
+my $traceDest  = $ipprc->filename("TRACE.EXP",          $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR);
+my $logDest    = $ipprc->filename("LOG.EXP", 	        $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR);
 
 # convert supplied DVO database name to UNIX filename
@@ -184,5 +185,5 @@
     # Make the jpeg for binning 1
     {
-	my $command = "$ppImage -list $list1Name $outputRoot -recipe PPIMAGE $recipe1"; # Command to run
+	my $command = "$ppImage -list $list1Name $outroot -recipe PPIMAGE $recipe1"; # Command to run
 	my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
 	    run(command => $command, verbose => 1);
@@ -196,5 +197,5 @@
     # Make the jpeg for binning 2
     {
-	my $command = "$ppImage -list $list2Name $outputRoot -recipe PPIMAGE $recipe2"; # Command to run
+	my $command = "$ppImage -list $list2Name $outroot -recipe PPIMAGE $recipe2"; # Command to run
 	my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
 	    run(command => $command, verbose => 1);
@@ -229,5 +230,5 @@
 	    # XXX add a ppStats call which will collect the astrometry stats
 	    my $command;
-	    $command  = "$psastro -list $list3Name $outputRoot";
+	    $command  = "$psastro -list $list3Name $outroot";
 	    $command .= " +mosastro -chipastro";
 	    $command .= " -F PSASTRO.OUTPUT PSASTRO.OUTPUT.MEF";
@@ -276,5 +277,5 @@
 $fpaCommand .= " -cam_id $cam_id";
 $fpaCommand .= " -uri UNKNOWN";
-$fpaCommand .= " -path_base $outputRoot";
+$fpaCommand .= " -path_base $outroot";
 $fpaCommand .= " -dbname $dbname" if defined $dbname;
 $fpaCommand .= $chipStats->cmdflags();
Index: /trunk/ippScripts/scripts/chip_imfile.pl
===================================================================
--- /trunk/ippScripts/scripts/chip_imfile.pl	(revision 16195)
+++ /trunk/ippScripts/scripts/chip_imfile.pl	(revision 16196)
@@ -33,14 +33,14 @@
 
 # Parse the command-line arguments
-my ($exp_id, $chip_id, $class_id, $uri, $exp_tag, $camera, $dbname, $workdir, $reduction, $no_update, $no_op);
+my ($exp_id, $exp_tag, $chip_id, $class_id, $uri, $camera, $outroot, $dbname, $reduction, $no_update, $no_op);
 GetOptions(
 	   'exp_id=s'      => \$exp_id,    # Exposure identifier		       
+	   'exp_tag=s'     => \$exp_tag,   # Exposure identifier		       
 	   'chip_id=s'     => \$chip_id,   # Chiptool identifier		       
 	   'class_id=s'    => \$class_id,  # Class identifier		       
 	   'uri|u=s'       => \$uri,       # Input FITS file		       
 	   'camera|c=s'    => \$camera,	   # Camera			       
+	   'outroot|w=s'   => \$outroot,   # output file base name
 	   'dbname|d=s'    => \$dbname,    # Database name
-	   'exp_tag=s'     => \$exp_tag,    # Exposure identifier		       
-	   'workdir|w=s'   => \$workdir,   # Working directory, for output files  
 	   'reduction=s'   => \$reduction, # Reduction class		       
 	   'no-update'     => \$no_update, # Don't update the database?	       
@@ -49,12 +49,13 @@
 
 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
-pod2usage( -msg => "Required options: --exp_id --exp_tag --chip_id --class_id --uri --camera",
+pod2usage( -msg => "Required options: --exp_id --exp_tag --chip_id --class_id --uri --camera --outroot",
 	   -exitval => 3) unless
     defined $exp_id and
+    defined $exp_tag and
     defined $chip_id and
     defined $class_id and
     defined $uri and
-    defined $exp_tag and
-    defined $camera;
+    defined $camera and
+    defined $outroot;
 
 $ipprc->define_camera($camera);
@@ -100,21 +101,27 @@
 &my_die("Couldn't find input file: $uri\n", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($uri);
 
-$workdir = caturi( $workdir, $exp_tag ) if defined $workdir;
-
-my $outputRoot  = $ipprc->file_prepare( "$exp_tag.ch.$chip_id", $workdir, $uri );
-
-my $outputImage = $ipprc->filename("PPIMAGE.CHIP",      $outputRoot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
-my $outputMask  = $ipprc->filename("PPIMAGE.CHIP.MASK", $outputRoot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
-my $outputWeight  = $ipprc->filename("PPIMAGE.CHIP.WEIGHT", $outputRoot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
-my $outputBin1  = $ipprc->filename("PPIMAGE.BIN1",      $outputRoot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
-my $outputBin2  = $ipprc->filename("PPIMAGE.BIN2",  	$outputRoot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
-my $outputStats = $ipprc->filename("PPIMAGE.STATS", 	$outputRoot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
-
-my $traceDest = 'file:' . $ipprc->file_resolve($outputRoot) . ".$class_id.trace"; # Trace messages
-my $logDest = 'file:' . $ipprc->file_resolve($outputRoot) . ".$class_id.log"; # Log messages
+# outroot examples (HOST components must be set)
+# file://data/ipp004.0/gpc1/20080130
+# neb:///ipp004-v1/gpc1/20080130
+# neb:///*/gpc1/20080130 (volume not specified)
+
+# check for existing directory, generate if needed
+$ipprc->outroot_prepare($outroot);
+
+## these names are used in ppImage, and thus may be URIs
+my $outputImage   = $ipprc->filename("PPIMAGE.CHIP",        $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
+my $outputMask    = $ipprc->filename("PPIMAGE.CHIP.MASK",   $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
+my $outputWeight  = $ipprc->filename("PPIMAGE.CHIP.WEIGHT", $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
+my $outputBin1    = $ipprc->filename("PPIMAGE.BIN1",        $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
+my $outputBin2    = $ipprc->filename("PPIMAGE.BIN2",  	    $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
+my $outputStats   = $ipprc->filename("PPIMAGE.STATS", 	    $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
+my $traceDest     = $ipprc->filename("TRACE.IMFILE", 	    $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
+my $logDest       = $ipprc->filename("LOG.IMFILE", 	    $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
 
 # Run ppImage
 unless ($no_op) {
-    my $command = "$ppImage -file $uri $outputRoot";
+    ## XXX can we convert ppImage log and trace to use the filerules to generate consistent names
+    ## XXX also stats: output should be implied by $outroot
+    my $command = "$ppImage -file $uri $outroot";
     $command .= " -recipe PPIMAGE $recipe";
     $command .= " -recipe PPSTATS CHIPSTATS";
@@ -130,10 +137,10 @@
     }
 
-    &my_die("Couldn't find expected output file: $outputImage\n", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputImage);
-    &my_die("Couldn't find expected output file: $outputMask\n",  $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputMask);
-    &my_die("Couldn't find expected output file: $outputWeight\n",  $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputWeight);
-    &my_die("Couldn't find expected output file: $outputBin1\n",  $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputBin1);
-    &my_die("Couldn't find expected output file: $outputBin2\n",  $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputBin2);
-    &my_die("Couldn't find expected output file: $outputStats\n", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputStats);
+    &my_die("Couldn't find expected output file: $outputImage\n",  $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputImage);
+    &my_die("Couldn't find expected output file: $outputMask\n",   $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputMask);
+    &my_die("Couldn't find expected output file: $outputWeight\n", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputWeight);
+    &my_die("Couldn't find expected output file: $outputBin1\n",   $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputBin1);
+    &my_die("Couldn't find expected output file: $outputBin2\n",   $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputBin2);
+    &my_die("Couldn't find expected output file: $outputStats\n",  $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputStats);
 
     # Get the statistics on the processed image
@@ -162,5 +169,5 @@
 $command .= " -class_id $class_id";
 $command .= " -uri $outputImage";
-$command .= " -path_base $outputRoot";
+$command .= " -path_base $outroot";
 $command .= " -dbname $dbname" if defined $dbname;
 $command .= $stats->cmdflags();
Index: /trunk/ippScripts/scripts/detrend_norm_apply.pl
===================================================================
--- /trunk/ippScripts/scripts/detrend_norm_apply.pl	(revision 16195)
+++ /trunk/ippScripts/scripts/detrend_norm_apply.pl	(revision 16196)
@@ -33,5 +33,5 @@
 
 # Parse the command-line
-my ($det_id, $iter, $class_id, $value, $input_uri, $camera, $det_type, $dbname, $workdir, $no_update, $no_op);
+my ($det_id, $iter, $class_id, $value, $input_uri, $camera, $det_type, $outroot, $dbname, $no_update, $no_op);
 GetOptions(
     'det_id|d=s'        => \$det_id,     # Detrend ID				
@@ -42,6 +42,6 @@
     'camera|c=s'        => \$camera,	 # Camera				
     'det_type|t=s'      => \$det_type,	 # Detrend type				
+    'outroot|w=s'       => \$outroot,    # output file base name
     'dbname|d=s'        => \$dbname,	 # Database name				
-    'workdir|w=s'       => \$workdir, 	 # Working directory, for output files	
     'no-update'         => \$no_update,	 # Don't update the database		
     'no-op'             => \$no_op,	 # Don't do any operations               
@@ -49,13 +49,14 @@
     
 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
-pod2usage( -msg => "Required options: --det_id --iteration --class_id --value --input_uri --camera --det_type",
-	   -exitval => 3) 
-    unless defined $det_id
-    and defined $iter
-    and defined $class_id
-    and defined $value
-    and defined $input_uri
-    and defined $camera
-    and defined $det_type;
+pod2usage( -msg => "Required options: --det_id --iteration --class_id --value --input_uri --camera --det_type --outroot",
+	   -exitval => 3) unless 
+    defined $det_id    and 
+    defined $iter      and 
+    defined $class_id  and 
+    defined $value     and 
+    defined $input_uri and 
+    defined $camera    and 
+    defined $det_type  and
+    defined $outroot;
 
 $ipprc->define_camera($camera);
@@ -90,19 +91,22 @@
 &my_die("Couldn't find input file: $input_uri\n", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($input_uri);
 
-$workdir = caturi( $workdir, "$camera.$det_type.$det_id" ) if defined $workdir;
-
-my $outputRoot = $ipprc->file_prepare( "$camera.$det_type.norm.$det_id.$iter", $workdir, $input_uri );
-
-my $output    = $ipprc->filename("PPIMAGE.OUTPUT", $outputRoot, $class_id);
-my $b1name    = $ipprc->filename("PPIMAGE.BIN1",   $outputRoot, $class_id);
-my $b2name    = $ipprc->filename("PPIMAGE.BIN2",   $outputRoot, $class_id);
-my $statsName = $ipprc->filename("PPIMAGE.STATS",  $outputRoot, $class_id);
-
-my $traceDest = 'file:' . $ipprc->file_resolve($outputRoot) . ".$class_id.trace"; # Trace messages
-my $logDest = 'file:' . $ipprc->file_resolve($outputRoot) . ".$class_id.log"; # Log messages
+# outroot examples (HOST components must be set)
+# file://data/ipp004.0/gpc1/20080130
+# neb:///ipp004-v1/gpc1/20080130
+# neb:///*/gpc1/20080130 (volume not specified)
+
+# check for existing directory, generate if needed
+$ipprc->outroot_prepare($outroot);
+
+my $output    = $ipprc->filename("PPIMAGE.OUTPUT", $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR);
+my $b1name    = $ipprc->filename("PPIMAGE.BIN1",   $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR);
+my $b2name    = $ipprc->filename("PPIMAGE.BIN2",   $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR);
+my $statsName = $ipprc->filename("PPIMAGE.STATS",  $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR);
+my $traceDest = $ipprc->filename("TRACE.IMFILE",   $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR);
+my $logDest   = $ipprc->filename("LOG.IMFILE", 	   $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR);
 
 # Run normalisation
 unless ($no_op) {
-    my $command = "$ppImage -file $input_uri $outputRoot";
+    my $command = "$ppImage -file $input_uri $outroot";
     $command .= " -norm $value -stats $statsName";
     $command .= " -recipe PPIMAGE $RECIPE_PPIMAGE";
@@ -118,7 +122,7 @@
 	&my_die("Unable to perform ppImage: $error_code", $det_id, $iter, $class_id, $error_code);
     }
-    &my_die("Can't find expected output file: $output", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($output);
-    &my_die("Can't find expected output file: $b1name", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($b1name);
-    &my_die("Can't find expected output file: $b2name", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($b2name);
+    &my_die("Can't find expected output file: $output",    $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($output);
+    &my_die("Can't find expected output file: $b1name",    $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($b1name);
+    &my_die("Can't find expected output file: $b2name",    $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($b2name);
     &my_die("Can't find expected output file: $statsName", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($statsName);
     
@@ -149,5 +153,5 @@
 $command .= " -class_id $class_id";
 $command .= " -uri $output";
-$command .= " -path_base $outputRoot";
+$command .= " -path_base $outroot";
 $command .= " -dbname $dbname" if defined $dbname;
 $command .= $stats->cmdflags();
Index: /trunk/ippScripts/scripts/detrend_norm_calc.pl
===================================================================
--- /trunk/ippScripts/scripts/detrend_norm_calc.pl	(revision 16195)
+++ /trunk/ippScripts/scripts/detrend_norm_calc.pl	(revision 16196)
@@ -32,10 +32,10 @@
 
 # Parse command-line arguments
-my ($det_id, $iter, $detType, $workdir, $dbname, $no_update, $no_op);
+my ($det_id, $iter, $detType, $outroot, $dbname, $no_update, $no_op);
 GetOptions(
 	'det_id|d=s'	=> \$det_id,    # Detrend id			     
 	'iteration|i=s'	=> \$iter,	# Iteration			     
 	'det_type|t=s'  => \$detType,	# Detrend type			     
-	'workdir|w=s'   => \$workdir,	# Working directory for output files 
+        'outroot|w=s'   => \$outroot,   # output file base name
  	'dbname|d=s'    => \$dbname,	# Database name			     
         'no-update'     => \$no_update,	# Don't update the database?	     
@@ -44,10 +44,11 @@
 
 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
-pod2usage( -msg => "Required options --det_id --iteration --det_type",
+pod2usage( -msg => "Required options --det_id --iteration --det_type --outroot",
 	   -exitval => 3,
-	   ) 
-    unless defined $det_id
-    and defined $iter
-    and defined $detType;
+	   ) unless 
+    defined $det_id  and 
+    defined $iter    and 
+    defined $detType and
+    defined $outroot;
 
 use constant STATISTIC => 'bg'; # Background statistic to use from the database
Index: /trunk/ippScripts/scripts/detrend_norm_exp.pl
===================================================================
--- /trunk/ippScripts/scripts/detrend_norm_exp.pl	(revision 16195)
+++ /trunk/ippScripts/scripts/detrend_norm_exp.pl	(revision 16196)
@@ -35,5 +35,5 @@
 use Pod::Usage qw( pod2usage );
 
-my ($det_id, $iter, $det_type, $camera, $dbname, $workdir, $reduction, $no_update, $no_op);
+my ($det_id, $iter, $det_type, $camera, $outroot, $dbname, $reduction, $no_update, $no_op);
 GetOptions(
 	   'det_id|d=s'        => \$det_id,
@@ -41,6 +41,6 @@
 	   'camera|c=s'        => \$camera,
 	   'det_type|t=s'      => \$det_type,
+	   'outroot|w=s'       => \$outroot,   # output file base name
 	   'dbname|d=s'        => \$dbname, # Database name
-	   'workdir|w=s'       => \$workdir,	# Working directory, for output files
 	   'reduction|=s'      => \$reduction,
 	   'no-update'         => \$no_update,
@@ -49,10 +49,11 @@
 
 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
-pod2usage( -msg => "Required options: --det_id --iteration --camera --det_type",
-	   -exitval => 3)
-    unless defined $det_id
-    and defined $iter
-    and defined $camera
-    and defined $det_type;
+pod2usage( -msg => "Required options: --det_id --iteration --camera --det_type --outroot",
+	   -exitval => 3) unless 
+    defined $det_id   and 
+    defined $iter     and 
+    defined $camera   and 
+    defined $det_type and
+    defined $outroot;
 
 $ipprc->define_camera($camera);
@@ -126,13 +127,18 @@
 close $list2File;
 
-# Output products
-$workdir = caturi( $workdir, "$camera.$det_type.$det_id" ) if defined $workdir;
-my $outputRoot = $ipprc->file_prepare( "$camera.$det_type.norm.$det_id.$iter", $workdir );
-my $jpeg1Name = $ipprc->filename("PPIMAGE.JPEG1", $outputRoot); # Binned JPEG #1
-my $jpeg2Name = $ipprc->filename("PPIMAGE.JPEG2", $outputRoot); # Binned JPEG #2
+# outroot examples (HOST components must be set)
+# file://data/ipp004.0/gpc1/20080130
+# neb:///ipp004-v1/gpc1/20080130
+# neb:///*/gpc1/20080130 (volume not specified)
+
+# check for existing directory, generate if needed
+$ipprc->outroot_prepare($outroot);
+
+my $jpeg1Name = $ipprc->filename("PPIMAGE.JPEG1", $outroot); # Binned JPEG #1
+my $jpeg2Name = $ipprc->filename("PPIMAGE.JPEG2", $outroot); # Binned JPEG #2
 
 unless ($no_op) {
     # Make the jpeg for binning 1
-    $command = "$ppImage -list $list1Name $outputRoot -recipe PPIMAGE $recipe1"; # Command to run
+    $command = "$ppImage -list $list1Name $outroot -recipe PPIMAGE $recipe1"; # Command to run
     ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
 	run(command => $command, verbose => 1);
@@ -140,5 +146,5 @@
     
     # Make the jpeg for binning 2
-    $command = "$ppImage -list $list2Name $outputRoot -recipe PPIMAGE $recipe2"; # Command to run
+    $command = "$ppImage -list $list2Name $outroot -recipe PPIMAGE $recipe2"; # Command to run
     ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
 	run(command => $command, verbose => 1);
@@ -152,5 +158,5 @@
 $command .= " -iteration $iter";
 $command .= " -recip $recipe1,$recipe2";
-$command .= " -path_base $outputRoot ";
+$command .= " -path_base $outroot ";
 $command .= " -dbname $dbname" if defined $dbname;
 $command .= $stats->cmdflags();
Index: /trunk/ippScripts/scripts/detrend_process_exp.pl
===================================================================
--- /trunk/ippScripts/scripts/detrend_process_exp.pl	(revision 16195)
+++ /trunk/ippScripts/scripts/detrend_process_exp.pl	(revision 16196)
@@ -35,5 +35,5 @@
 use Pod::Usage qw( pod2usage );
 
-my ($det_id, $exp_id, $det_type, $exp_tag, $camera, $dbname, $workdir, $reduction, $no_update, $no_op);
+my ($det_id, $exp_id, $det_type, $exp_tag, $camera, $outroot, $dbname, $reduction, $no_update, $no_op);
 GetOptions(
     'det_id|d=s'        => \$det_id,
@@ -42,6 +42,6 @@
     'exp_tag|=s'        => \$exp_tag,
     'camera|c=s'        => \$camera,
+    'outroot|w=s'       => \$outroot,   # output file base name
     'dbname|d=s'        => \$dbname, # Database name
-    'workdir|w=s'       => \$workdir,	# Working directory, for output files
     'reduction|=s'      => \$reduction,
     'no-update'         => \$no_update,
@@ -50,11 +50,12 @@
 
 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
-pod2usage( -msg => "Required options: --det_id --det_type --exp_id --exp_tag --camera",
-	   -exitval => 3) 
-    unless defined $det_id
-    and defined $det_type
-    and defined $exp_id
-    and defined $exp_tag
-    and defined $camera;
+pod2usage( -msg => "Required options: --det_id --det_type --exp_id --exp_tag --camera --outroot",
+	   -exitval => 3) unless 
+    defined $det_id   and 
+    defined $det_type and 
+    defined $exp_id   and 
+    defined $exp_tag  and 
+    defined $camera   and
+    defined $outroot;
 
 $ipprc->define_camera($camera);
@@ -129,13 +130,18 @@
 close $list2File;
 
-# Output files
-$workdir = caturi( $workdir, "$camera.$det_type.$det_id" ) if defined $workdir;
-my $outputRoot = $ipprc->file_prepare( "$exp_tag/$exp_tag.detproc.$det_id", $workdir, ${$files}[0]->{path_base} );
-my $jpeg1 = $ipprc->filename("PPIMAGE.JPEG1", $outputRoot); # Binned JPEG #1
-my $jpeg2 = $ipprc->filename("PPIMAGE.JPEG2", $outputRoot); # Binned JPEG #2
+# outroot examples (HOST components must be set)
+# file://data/ipp004.0/gpc1/20080130
+# neb:///ipp004-v1/gpc1/20080130
+# neb:///*/gpc1/20080130 (volume not specified)
+
+# check for existing directory, generate if needed
+$ipprc->outroot_prepare($outroot);
+
+my $jpeg1 = $ipprc->filename("PPIMAGE.JPEG1", $outroot); # Binned JPEG #1
+my $jpeg2 = $ipprc->filename("PPIMAGE.JPEG2", $outroot); # Binned JPEG #2
 
 unless ($no_op) {
     # Make the jpeg for binning 1
-    $command = "$ppImage -list $list1Name $outputRoot -recipe PPIMAGE $recipe1"; # Command to run
+    $command = "$ppImage -list $list1Name $outroot -recipe PPIMAGE $recipe1"; # Command to run
     ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
 	run(command => $command, verbose => 1);
@@ -147,5 +153,5 @@
     
     # Make the jpeg for binning 2
-    $command = "$ppImage -list $list2Name $outputRoot -recipe PPIMAGE $recipe2"; # Command to run
+    $command = "$ppImage -list $list2Name $outroot -recipe PPIMAGE $recipe2"; # Command to run
     ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
 	run(command => $command, verbose => 1);
@@ -161,5 +167,5 @@
 $command .= " -det_id $det_id";
 $command .= " -exp_id $exp_id";
-$command .= " -recip $recipe1,$recipe2 -path_base $outputRoot";
+$command .= " -recip $recipe1,$recipe2 -path_base $outroot";
 $command .= " -dbname $dbname" if defined $dbname;
 $command .= $stats->cmdflags();
Index: /trunk/ippScripts/scripts/detrend_process_imfile.pl
===================================================================
--- /trunk/ippScripts/scripts/detrend_process_imfile.pl	(revision 16195)
+++ /trunk/ippScripts/scripts/detrend_process_imfile.pl	(revision 16196)
@@ -32,5 +32,5 @@
 use Pod::Usage qw( pod2usage );
 
-my ($det_id, $exp_id, $class_id, $det_type, $exp_tag, $input_uri, $camera, $dbname, $workdir, $reduction, $no_update, $no_op);
+my ($det_id, $exp_id, $class_id, $det_type, $exp_tag, $input_uri, $camera, $outroot, $dbname, $reduction, $no_update, $no_op);
 GetOptions(
     'det_id|d=s'        => \$det_id,
@@ -41,6 +41,6 @@
     'input_uri|u=s'     => \$input_uri,
     'camera|c=s'        => \$camera,
+    'outroot|w=s'       => \$outroot, # output file base name
     'dbname|d=s'        => \$dbname, # Database name
-    'workdir|w=s'       => \$workdir, # Working directory, for output files
     'reduction=s'       => \$reduction,	# Reduction class
     'no-update'         => \$no_update,
@@ -49,13 +49,14 @@
 
 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
-pod2usage( -msg => "Required options: --det_id --exp_id --class_id --det_type --exp_tag --input_uri --camera",
-	   -exitval => 3)
-    unless defined $det_id
-    and defined $exp_id
-    and defined $class_id
-    and defined $det_type
-    and defined $exp_tag
-    and defined $input_uri
-    and defined $camera;
+pod2usage( -msg => "Required options: --det_id --exp_id --class_id --det_type --exp_tag --input_uri --camera --outroot",
+	   -exitval => 3) unless 
+    defined $det_id    and
+    defined $exp_id    and 
+    defined $class_id  and 
+    defined $det_type  and 
+    defined $exp_tag   and 
+    defined $input_uri and 
+    defined $camera    and 
+    defined $outroot;
 
 # XXX this exits with status = 0 on failure
@@ -88,19 +89,22 @@
 &my_die("Couldn't find input file: $input_uri\n", $det_id, $exp_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($input_uri);
 
-$workdir = caturi( $workdir, "$camera.$det_type.$det_id" ) if defined $workdir;
+# outroot examples (HOST components must be set)
+# file://data/ipp004.0/gpc1/20080130
+# neb:///ipp004-v1/gpc1/20080130
+# neb:///*/gpc1/20080130 (volume not specified)
 
-my $outputRoot  = $ipprc->file_prepare( "$exp_tag/$exp_tag.detproc.$det_id", $workdir, $input_uri );
+# check for existing directory, generate if needed
+$ipprc->outroot_prepare($outroot);
 
-my $outputImage = $ipprc->filename("PPIMAGE.OUTPUT", $outputRoot, $class_id) or &my_die("Missing entry from camera config", $det_id, $exp_id, $class_id, $PS_EXIT_PROG_ERROR);
-my $outputBin1  = $ipprc->filename("PPIMAGE.BIN1",   $outputRoot, $class_id) or &my_die("Missing entry from camera config", $det_id, $exp_id, $class_id, $PS_EXIT_PROG_ERROR);
-my $outputBin2  = $ipprc->filename("PPIMAGE.BIN2",   $outputRoot, $class_id) or &my_die("Missing entry from camera config", $det_id, $exp_id, $class_id, $PS_EXIT_PROG_ERROR);
-my $outputStats = $ipprc->filename("PPIMAGE.STATS",  $outputRoot, $class_id) or &my_die("Missing entry from camera config", $det_id, $exp_id, $class_id, $PS_EXIT_PROG_ERROR);
-
-my $traceDest = 'file:' . $ipprc->file_resolve($outputRoot) . ".$class_id.trace"; # Trace messages
-my $logDest = 'file:' . $ipprc->file_resolve($outputRoot) . ".$class_id.log"; # Log messages
+my $outputImage = $ipprc->filename("PPIMAGE.OUTPUT", $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $exp_id, $class_id, $PS_EXIT_PROG_ERROR);
+my $outputBin1  = $ipprc->filename("PPIMAGE.BIN1",   $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $exp_id, $class_id, $PS_EXIT_PROG_ERROR);
+my $outputBin2  = $ipprc->filename("PPIMAGE.BIN2",   $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $exp_id, $class_id, $PS_EXIT_PROG_ERROR);
+my $outputStats = $ipprc->filename("PPIMAGE.STATS",  $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $exp_id, $class_id, $PS_EXIT_PROG_ERROR);
+my $traceDest   = $ipprc->filename("TRACE.IMFILE",   $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
+my $logDest     = $ipprc->filename("LOG.IMFILE",     $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
 
 # Run ppImage
 unless ($no_op) {
-    my $command = "$ppImage -file $input_uri $outputRoot";
+    my $command = "$ppImage -file $input_uri $outroot";
     $command .= " -recipe PPIMAGE $recipe";
     $command .= " -recipe PPSTATS CHIPSTATS";
@@ -141,5 +145,5 @@
 $command .= " -class_id $class_id";
 $command .= " -recip $reduction";
-$command .= " -uri $outputImage -path_base $outputRoot";
+$command .= " -uri $outputImage -path_base $outroot";
 $command .= " -dbname $dbname" if defined $dbname;
 $command .= $stats->cmdflags();
Index: /trunk/ippScripts/scripts/detrend_reject_exp.pl
===================================================================
--- /trunk/ippScripts/scripts/detrend_reject_exp.pl	(revision 16195)
+++ /trunk/ippScripts/scripts/detrend_reject_exp.pl	(revision 16196)
@@ -37,5 +37,5 @@
 use Pod::Usage qw( pod2usage );
 
-my ($det_id, $iter, $det_type, $camera, $filter, $workdir, $dbname, $no_update, $no_op);
+my ($det_id, $iter, $det_type, $camera, $outroot, $filter, $dbname, $no_update, $no_op);
 GetOptions(
 	   'det_id|d=s'        => \$det_id,
@@ -43,6 +43,6 @@
 	   'det_type|t=s'      => \$det_type,
 	   'camera=s'          => \$camera,
+	   'outroot|w=s'   => \$outroot,   # output file base name
 	   'filter=s'          => \$filter,
-	   'workdir|w=s'       => \$workdir, # Working directory for output files
 	   'dbname|d=s'        => \$dbname, # Database name
 	   'no-update'         => \$no_update,
@@ -51,10 +51,11 @@
 
 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
-pod2usage( -msg => "Required options: --det_id --iteration --det_type --camera",
-	   -exitval => 3)
-    unless defined $det_id
-    and defined $iter
-    and defined $det_type
-    and defined $camera;
+pod2usage( -msg => "Required options: --det_id --iteration --det_type --camera --outroot",
+	   -exitval => 3) unless 
+    defined $det_id   and 
+    defined $iter     and 
+    defined $det_type and 
+    defined $camera   and
+    defined $outroot;
 
 # values to extract from output metadata and the stats to calculate
@@ -141,7 +142,13 @@
 my $reject_meanstdev = rejection_limit( 'ENSEMBLE.MEANSTDEV', $det_type, $filter );
 
-$workdir = caturi( $workdir, "$camera.$det_type.$det_id" ) if defined $workdir;
-
-my $logName = $ipprc->file_prepare( "$camera.$det_type.$det_id.$iter.detreject.log", $workdir ); # Name for log
+# outroot examples (HOST components must be set)
+# file://data/ipp004.0/gpc1/20080130
+# neb:///ipp004-v1/gpc1/20080130
+# neb:///*/gpc1/20080130 (volume not specified)
+
+# check for existing directory, generate if needed
+$ipprc->outroot_prepare($outroot);
+
+my $logName = $outroot . "log"; # Name for log
 
 my $logFile;
Index: /trunk/ippScripts/scripts/detrend_reject_imfile.pl
===================================================================
--- /trunk/ippScripts/scripts/detrend_reject_imfile.pl	(revision 16195)
+++ /trunk/ippScripts/scripts/detrend_reject_imfile.pl	(revision 16196)
@@ -43,5 +43,5 @@
 
 # parse the command-line options
-my ($det_id, $iter, $exp_id, $exp_tag, $det_type, $camera, $filter, $reject, $dbname, $workdir, $reduction, $no_update, $no_op);
+my ($det_id, $iter, $exp_id, $exp_tag, $det_type, $camera, $filter, $reject, $outroot, $dbname, $reduction, $no_update, $no_op);
 GetOptions(
 	   'det_id|d=s'        => \$det_id,
@@ -51,8 +51,8 @@
 	   'det_type|t=s'      => \$det_type,
 	   'camera=s'          => \$camera,
+	   'outroot|w=s'       => \$outroot,   # output file base name
 	   'filter=s'          => \$filter,
 	   'reject'            => \$reject,
 	   'dbname|d=s'        => \$dbname, # Database name
-	   'workdir|w=s'       => \$workdir, # Working directory, for output files
 	   'reduction|=s'      => \$reduction,
 	   'no-update'         => \$no_update,
@@ -61,12 +61,13 @@
 
 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
-pod2usage( -msg => "Required options: --det_id --iteration --exp_id --exp_tag --det_type --camera",
-	   -exitval => 3)
-    unless defined $det_id
-    and defined $iter
-    and defined $exp_id
-    and defined $exp_tag
-    and defined $det_type
-    and defined $camera;
+pod2usage( -msg => "Required options: --det_id --iteration --exp_id --exp_tag --det_type --camera --outroot",
+	   -exitval => 3) unless 
+    defined $det_id   and 
+    defined $iter     and 
+    defined $exp_id   and 
+    defined $exp_tag  and 
+    defined $det_type and 
+    defined $camera   and
+    defined $outroot;
 
 # load IPP config information for the specified camera
@@ -144,10 +145,15 @@
 }
 
-# Output products
-$workdir = caturi( $workdir, "$camera.$det_type.$det_id" ) if defined $workdir;
-my $outputRoot = $ipprc->file_prepare( "$exp_tag/$exp_tag.detresid.$det_id.$iter", $workdir, ${$files}[0]->{path_base} );
-my $jpeg1Name  = $ipprc->filename("PPIMAGE.JPEG1", $outputRoot); # Binned JPEG #1
-my $jpeg2Name  = $ipprc->filename("PPIMAGE.JPEG2", $outputRoot); # Binned JPEG #2
-my $logName    = $ipprc->filename("LOG.EXP", $outputRoot); # Name for log
+# outroot examples (HOST components must be set)
+# file://data/ipp004.0/gpc1/20080130
+# neb:///ipp004-v1/gpc1/20080130
+# neb:///*/gpc1/20080130 (volume not specified)
+
+# check for existing directory, generate if needed
+$ipprc->outroot_prepare($outroot);
+
+my $jpeg1Name  = $ipprc->filename("PPIMAGE.JPEG1", $outroot); # Binned JPEG #1
+my $jpeg2Name  = $ipprc->filename("PPIMAGE.JPEG2", $outroot); # Binned JPEG #2
+my $logName    = $ipprc->filename("LOG.EXP",       $outroot); # Name for log
 
 my $logFile;
@@ -170,5 +176,5 @@
 unless ($no_op) {
     # Make the jpeg for binning 1
-    $command = "$ppImage -list $list1Name $outputRoot -recipe PPIMAGE $recipe1"; # Command to run
+    $command = "$ppImage -list $list1Name $outroot -recipe PPIMAGE $recipe1"; # Command to run
     ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
 	run(command => $command, verbose => 1);
@@ -180,5 +186,5 @@
     
     # Make the jpeg for binning 2
-    $command = "$ppImage -list $list2Name $outputRoot -recipe PPIMAGE $recipe2"; # Command to run
+    $command = "$ppImage -list $list2Name $outroot -recipe PPIMAGE $recipe2"; # Command to run
     ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
 	run(command => $command, verbose => 1);
@@ -502,5 +508,5 @@
 
 $command  = "$dettool -addresidexp -det_id $det_id -iteration $iter -exp_id $exp_id";
-$command .= " -recip $recipe1,$recipe2 -path_base $outputRoot ";
+$command .= " -recip $recipe1,$recipe2 -path_base $outroot ";
 $command .= ' -reject' if $reject;
 $command .= " -dbname $dbname" if defined $dbname;
Index: /trunk/ippScripts/scripts/detrend_resid.pl
===================================================================
--- /trunk/ippScripts/scripts/detrend_resid.pl	(revision 16195)
+++ /trunk/ippScripts/scripts/detrend_resid.pl	(revision 16196)
@@ -32,5 +32,5 @@
 use Pod::Usage qw( pod2usage );
 
-my ($det_id, $iter, $exp_id, $exp_tag, $class_id, $det_type, $detrend, $input_uri, $camera, $mode, $dbname, $workdir, $reduction, $no_update, $no_op);
+my ($det_id, $iter, $exp_id, $exp_tag, $class_id, $det_type, $detrend, $input_uri, $camera, $mode, $outroot, $dbname, $reduction, $no_update, $no_op);
 GetOptions(
     'det_id|d=s'        => \$det_id,
@@ -44,6 +44,6 @@
     'camera|c=s'        => \$camera,
     'mode|m=s'          => \$mode,
+    'outroot|w=s'       => \$outroot,   # output file base name
     'dbname|d=s'        => \$dbname, # Database name
-    'workdir|w=s'       => \$workdir,	# Working directory, for output files
     'reduction=s'       => \$reduction,	# Reduction class
     'no-update'         => \$no_update,
@@ -52,16 +52,17 @@
 
 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
-pod2usage( -msg => "Required options: --det_id --iteration --exp_id --exp_tag --class_id --det_type --camera --input_uri --mode --detrend (not for 'verify' mode)",
-	   -exitval => 3)
-    unless defined $det_id
-    and defined $iter
-    and defined $exp_id
-    and defined $exp_tag
-    and defined $class_id
-    and defined $det_type
-    and defined $input_uri
-    and defined $camera
-    and defined $mode
-    and (defined $detrend or lc($mode) eq 'verify');
+pod2usage( -msg => "Required options: --det_id --iteration --exp_id --exp_tag --class_id --det_type --camera --input_uri --mode --detrend --outroot (not for 'verify' mode)",
+	   -exitval => 3) unless 
+    defined $det_id    and 
+    defined $iter      and 
+    defined $exp_id    and 
+    defined $exp_tag   and 
+    defined $class_id  and 
+    defined $det_type  and 
+    defined $input_uri and 
+    defined $camera    and 
+    defined $mode      and 
+    defined $outroot   and 
+    (defined $detrend or lc($mode) eq 'verify');
 
 $ipprc->define_camera($camera);
@@ -130,19 +131,22 @@
 $ppImage .= " -dbname $dbname" if defined $dbname;
 
-$workdir = caturi( $workdir, "$camera.$det_type.$det_id" ) if defined $workdir;
-
-my $outputRoot = $ipprc->file_prepare( "$exp_tag/$exp_tag.detresid.$det_id.$iter", $workdir, $input_uri );
-
-my $outputName  = $ipprc->filename("PPIMAGE.OUTPUT", $outputRoot, $class_id);
-my $bin1Name    = $ipprc->filename("PPIMAGE.BIN1", $outputRoot, $class_id);
-my $bin2Name    = $ipprc->filename("PPIMAGE.BIN2", $outputRoot, $class_id);
-my $outputStats = $ipprc->filename("PPIMAGE.STATS", $outputRoot, $class_id);
-
-my $traceDest = 'file:' . $ipprc->file_resolve($outputRoot) . ".$class_id.trace"; # Trace messages
-my $logDest = 'file:' . $ipprc->file_resolve($outputRoot) . ".$class_id.log"; # Log messages
+# outroot examples (HOST components must be set)
+# file://data/ipp004.0/gpc1/20080130
+# neb:///ipp004-v1/gpc1/20080130
+# neb:///*/gpc1/20080130 (volume not specified)
+
+# check for existing directory, generate if needed
+$ipprc->outroot_prepare($outroot);
+
+my $outputName  = $ipprc->filename("PPIMAGE.OUTPUT", $outroot, $class_id);
+my $bin1Name    = $ipprc->filename("PPIMAGE.BIN1",   $outroot, $class_id);
+my $bin2Name    = $ipprc->filename("PPIMAGE.BIN2",   $outroot, $class_id);
+my $outputStats = $ipprc->filename("PPIMAGE.STATS",  $outroot, $class_id);
+my $traceDest   = $ipprc->filename("TRACE.IMFILE",   $outroot, $class_id);
+my $logDest     = $ipprc->filename("LOG.IMFILE",     $outroot, $class_id);
 
 # Run ppImage & ppStats
 unless ($no_op) {
-    my $command = "$ppImage -file $input_uri $outputRoot";
+    my $command = "$ppImage -file $input_uri $outroot";
     $command .= " -recipe PPIMAGE $recipe";
     $command .= " -recipe PPSTATS RESIDUAL";
@@ -205,5 +209,5 @@
 $command .= " -recip $recipe";
 $command .= " -uri $outputName";
-$command .= " -path_base $outputRoot";
+$command .= " -path_base $outroot";
 $command .= " -dbname $dbname" if defined $dbname;
 $command .= $stats->cmdflags();
Index: /trunk/ippScripts/scripts/detrend_stack.pl
===================================================================
--- /trunk/ippScripts/scripts/detrend_stack.pl	(revision 16195)
+++ /trunk/ippScripts/scripts/detrend_stack.pl	(revision 16196)
@@ -33,5 +33,5 @@
 use Pod::Usage qw( pod2usage );
 
-my ($det_id, $iter, $class_id, $det_type, $camera, $dbname, $workdir, $reduction, $no_update, $no_op, $quiet);
+my ($det_id, $iter, $class_id, $det_type, $camera, $outroot, $dbname, $reduction, $no_update, $no_op, $quiet);
 GetOptions(
     'det_id|d=s'        => \$det_id,
@@ -40,6 +40,6 @@
     'det_type|t=s'      => \$det_type,
     'camera|c=s'        => \$camera,
+    'outroot|w=s'       => \$outroot,   # output file base name
     'dbname|d=s'        => \$dbname, # Database name
-    'workdir|w=s'       => \$workdir, # Working directory, for output files
     'reduction=s'       => \$reduction,	# Reduction class for processing
     'no-update'         => \$no_update,
@@ -49,11 +49,12 @@
 
 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
-pod2usage( -msg => "Required options: --det_id --iteration --class_id --det_type --camera", 
-	   -exitval => 3) 
-    unless defined $det_id
-    and defined $iter
-    and defined $class_id
-    and defined $det_type
-    and defined $camera;
+pod2usage( -msg => "Required options: --det_id --iteration --class_id --det_type --camera --outroot", 
+	   -exitval => 3) unless 
+    defined $det_id   and 
+    defined $iter     and 
+    defined $class_id and 
+    defined $det_type and 
+    defined $camera   and
+    defined $outroot;
 
 my $verbose = 1;
@@ -111,12 +112,17 @@
 }
 
-$workdir = caturi( $workdir, "$camera.$det_type.$det_id" ) if defined $workdir;
-
-my $outputRoot  = $ipprc->file_prepare( "$camera.$det_type.$det_id.$iter.$class_id", $workdir, ${$files}[0]->{uri} );
-my $outputStack = $outputRoot . '.fits'; # Output name
-my $outputStats = $outputRoot . '.stats'; # Statistics name
-
-my $traceDest = 'file:' . $ipprc->file_resolve($outputRoot) . ".trace"; # Trace messages
-my $logDest = 'file:' . $ipprc->file_resolve($outputRoot) . ".log"; # Log messages
+# outroot examples (HOST components must be set)
+# file://data/ipp004.0/gpc1/20080130
+# neb:///ipp004-v1/gpc1/20080130
+# neb:///*/gpc1/20080130 (volume not specified)
+
+# check for existing directory, generate if needed
+$ipprc->outroot_prepare($outroot);
+
+## XXX should we be using the filerules here?
+my $outputStack = $outroot . '.fits'; # Output name
+my $outputStats = $outroot . '.stats'; # Statistics name
+my $traceDest   = $outroot . '.trace'; # Trace messages
+my $logDest     = $outroot . '.log'; # Log messages
 
 $command = "$ppMerge $outputStack"; # Command to run
Index: /trunk/ippScripts/scripts/register_exp.pl
===================================================================
--- /trunk/ippScripts/scripts/register_exp.pl	(revision 16195)
+++ /trunk/ippScripts/scripts/register_exp.pl	(revision 16196)
@@ -34,10 +34,9 @@
     );
 
-my ($cache, $exp_id, $exp_tag, $workdir, $dbname, $no_update, $no_op);
+my ($cache, $exp_id, $exp_tag, $dbname, $no_update, $no_op);
 GetOptions(
     'caches'        => \$cache,
     'exp_id|e=s'    => \$exp_id,
     'exp_tag|t=s'   => \$exp_tag,
-    'workdir|w=s'   => \$workdir, # Working directory for output files
     'dbname|d=s'    => \$dbname, # Database name    
     'no-update'     => \$no_update,
Index: /trunk/ippScripts/scripts/register_imfile.pl
===================================================================
--- /trunk/ippScripts/scripts/register_imfile.pl	(revision 16195)
+++ /trunk/ippScripts/scripts/register_imfile.pl	(revision 16196)
@@ -37,5 +37,5 @@
 use Pod::Usage qw( pod2usage );
 
-my ($cache, $exp_id, $tmp_class_id, $tmp_exp_name, $uri, $workdir, $dbname, $no_update, $no_op);
+my ($cache, $exp_id, $tmp_class_id, $tmp_exp_name, $uri, $dbname, $no_update, $no_op);
 GetOptions(
     'caches'           => \$cache,
@@ -44,5 +44,4 @@
     'tmp_exp_name|n=s' => \$tmp_exp_name,
     'uri|u=s'          => \$uri,
-    'workdir|w=s'      => \$workdir, # Working directory for output files
     'dbname|d=s'       => \$dbname,# Database name
     'no-update'        => \$no_update,
