Index: trunk/ippScripts/scripts/receive_file.pl
===================================================================
--- trunk/ippScripts/scripts/receive_file.pl	(revision 23895)
+++ trunk/ippScripts/scripts/receive_file.pl	(revision 24038)
@@ -36,5 +36,5 @@
 
 # Parse the command-line arguments
-my ( $file_id, $source, $product, $fileset, $file, $workdir, $dbname, $verbose, $no_update, $save_temps );
+my ( $file_id, $source, $product, $fileset, $fileset_id, $file, $workdir, $dbname, $verbose, $no_update, $save_temps );
 
 GetOptions(
@@ -43,4 +43,5 @@
            'product=s'         => \$product, # Product for data
            'fileset=s'         => \$fileset, # Fileset for data
+           'fileset_id=s'      => \$fileset_id, # database id for the fileset
            'file=s'            => \$file, # File to retrieve
            'workdir=s'         => \$workdir, # Working directory for output
@@ -61,4 +62,6 @@
     defined $workdir;
 
+$tempdir .= "/$file_id";
+
 my $ipprc = PS::IPP::Config->new() or
     &my_die( "Unable to set up", $file_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
@@ -80,6 +83,11 @@
     # Load into database
 
+    my $target = "$workdir/$file"; # Target destination for file
+    my $fixName = $ipprc->file_create( $target ); # Target for move
+    my $fixFile;
+
+    open $fixFile, ">$fixName" or die "can't open $fixName\n";
+
     # Need to fix paths to point to new workdir
-    my ($fixFile, $fixName) = tempfile( "$tempdir/$file.XXXX", UNLINK => !$save_temps ); # Fixed file
     open my $inFile, $filename or die "Can't open $filename\n"; # Input file
     my $workdir_old;            # Old workdir
@@ -98,13 +106,13 @@
     }
     close($inFile);
-
-    my ($stage) = $file =~ m|^dbinfo\.(\S+)\.\d+\.mdc$|; # Stage of interest
-    my $tool = can_run("${stage}tool") or die "Can't find tool to load $file\n";
-
-    my $command = "$tool -importrun -infile $fixName"; # Command to execute
+    close($fixFile);
+#{
+    my $command = "$receivetool -updatefileset -fileset_id $fileset_id -dbinfo_uri $fixName"; # Command to execute
     $command .= " -dbname $dbname" if defined $dbname;
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
         run(command => $command, verbose => $verbose);
-    die "Unable to load $fixName\n" unless $success;
+    die "Unable to set dbinfo_uri for $fileset_id to  $fixName\n" unless $success;
+#}
+
 } elsif ($file =~ m|.*\.tgz$|) {
     # Get contents of tarball
