Index: trunk/ippScripts/scripts/chip_imfile.pl
===================================================================
--- trunk/ippScripts/scripts/chip_imfile.pl	(revision 20369)
+++ trunk/ippScripts/scripts/chip_imfile.pl	(revision 20927)
@@ -27,5 +27,5 @@
 
 # Parse the command-line arguments
-my ( $exp_id, $chip_id, $class_id, $uri, $camera, $outroot, $dbname, $run_state, $reduction, $threads, $verbose,
+my ( $exp_id, $chip_id, $class_id, $chip_imfile_id, $uri, $camera, $outroot, $dbname, $run_state, $reduction, $threads, $verbose,
      $no_update, $no_op, $redirect );
 GetOptions(
@@ -33,4 +33,5 @@
     'chip_id=s'         => \$chip_id,   # Chiptool identifier
     'class_id=s'        => \$class_id,  # Class identifier
+    'chip_imfile_id=s'  => \$chip_imfile_id, # Unique file identifier
     'uri|u=s'           => \$uri,       # Input FITS file
     'camera|c=s'        => \$camera,    # Camera
@@ -52,4 +53,5 @@
     defined $chip_id and
     defined $class_id and
+    ## defined $chip_imfile_id and  XXX until this is added to the scheme, do not require it : 
     defined $uri and
     defined $camera and
@@ -62,5 +64,10 @@
 $logDest .= ".update" if $run_state eq "update";
 
-$ipprc->redirect_output($logDest) if $redirect;
+if ($redirect) {
+    $ipprc->redirect_output($logDest);
+    print STDOUT "\n\n";
+    print STDOUT "Starting script $0 on $host\n\n";
+    print STDOUT "COMMAND IS: @ARGV\n\n";
+}
 
 # Look for programs we need
@@ -95,4 +102,7 @@
 $ipprc->outroot_prepare($outroot);
 
+my $image_id = $chip_imfile_id;
+my $source_id = $ipprc->source_id($dbname, $PS_TABLE_ID_CHIP);
+
 ## 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);
@@ -123,4 +133,6 @@
         $command .= " -threads $threads" if defined $threads;
         $command .= " -dbname $dbname" if defined $dbname;
+	# $command .= " -image_id $image_id" if defined $image_id;
+	# $command .= " -source_id $source_id" if defined $source_id;
         $command .= " -dumpconfig $configuration";
         $command .= " -tracedest $traceDest -log $logDest";
@@ -131,4 +143,6 @@
         $command .= " -threads $threads" if defined $threads;
         $command .= " -dbname $dbname" if defined $dbname;
+	# $command .= " -image_id $image_id" if defined $image_id;
+	# $command .= " -source_id $source_id" if defined $source_id;
         $command .= " -tracedest $traceDest -log $logDest";
         $command .= " -Db PPIMAGE:PHOTOM FALSE";
