Index: /trunk/ippTasks/summit.copy.pro
===================================================================
--- /trunk/ippTasks/summit.copy.pro	(revision 16375)
+++ /trunk/ippTasks/summit.copy.pro	(revision 16376)
@@ -3,4 +3,5 @@
 
 ## XXX note that this currently works with a single database as defined in .ipprc
+## XXX tie the database for output to the database from which the datastore was determined
 
 # pztool -adddatastore -inst isp -telescope ps1 -uri http://otis1.ifa.hawaii.edu/ds/skyprobe/index.txt
@@ -293,11 +294,13 @@
         book setword pzPendingImfile $pageName pantaskState RUN
 
-        book getword pzPendingImfile $pageName uri -var URI
-        book getword pzPendingImfile $pageName exp_name -var EXP_NAME
-        book getword pzPendingImfile $pageName class_id -var CLASS_ID
-        book getword pzPendingImfile $pageName bytes -var BYTES
-        book getword pzPendingImfile $pageName md5sum -var MD5SUM
-        book getword pzPendingImfile $pageName dateobs -var DATEOBS
-        book getword pzPendingImfile $pageName camera -var $CAMERA
+        book getword pzPendingImfile $pageName uri     	 -var URI
+        book getword pzPendingImfile $pageName bytes   	 -var BYTES
+        book getword pzPendingImfile $pageName md5sum  	 -var MD5SUM
+        book getword pzPendingImfile $pageName dateobs 	 -var DATEOBS
+        book getword pzPendingImfile $pageName exp_name  -var EXP_NAME
+        book getword pzPendingImfile $pageName camera    -var CAMERA
+        book getword pzPendingImfile $pageName telescope -var TELESCOPE
+        book getword pzPendingImfile $pageName class     -var CLASS
+        book getword pzPendingImfile $pageName class_id  -var CLASS_ID
 
         set.host.for.camera $CAMERA $CLASS_ID
@@ -328,8 +331,5 @@
         book setword pzPendingImfile $pageName filename $FILENAME
 
-        # store the pageName with this job
-        options $pageName $workdir
-
-        $run = dsget --uri $URI --filename $FILENAME
+        $run = summit_copy.pl --uri $URI --filename $FILENAME --exp_name $EXP_NAME --inst $CAMERA --telescope $TELESCOPE --class $CLASS --class_id $CLASS_ID --end_stage reg --workdir $workdir
 	if ($COMPRESS) 
             $run = $run --compress
@@ -343,4 +343,8 @@
             $run = $run --nebulous
         end
+        add_standard_args run
+
+        # store the pageName for future reference below
+        options $pageName
 
         # create the command line
@@ -348,66 +352,13 @@
           echo command $run
         end
-
         command $run
     end
 
-    # success
-    task.exit 0
-        # get related info from the associated page
-        book getword pzPendingImfile $options:0 exp_name -var EXP_NAME
-        book getword pzPendingImfile $options:0 class -var CLASS
-        book getword pzPendingImfile $options:0 camera -var CAMERA
-        book getword pzPendingImfile $options:0 telescope -var TELESCOPE
-        book getword pzPendingImfile $options:0 class_id -var CLASS_ID
-        book getword pzPendingImfile $options:0 filename -var FILENAME
-
-	# we need to set the values of tess_id, dvodb, end_stage, workdir here 
-        # these are functions of (at least) EXP_TYPE and SURVEY_ID, both of which should come from the data store
-
-	# we saved the workdir so we can pass it to pztool
-	$workdir = $options:1
-
-	# update the database with the success
-	# for the moment, let's not propagate these
-        $run = pztool -copydone -exp_name $EXP_NAME -inst $CAMERA -telescope $TELESCOPE -class $CLASS -class_id $CLASS_ID -uri $FILENAME -workdir $workdir -end_stage reg
-	# tess_id, dvodb, workdir, end_stage
-
-        # create the command line
-        if ($VERBOSE > 1)
-          echo exec $run
-        end
-        exec $run
-
-	# update the pantasks process tables
+    # default exit status
+    task.exit default
         process_exit pzPendingImfile $options:0 $JOB_STATUS
     end
 
-    task.exit default
-        showcommand failure
-
-        # get related info from the associated page
-        book getword pzPendingImfile $options:0 exp_name -var EXP_NAME
-        book getword pzPendingImfile $options:0 class -var CLASS
-        book getword pzPendingImfile $options:0 camera -var CAMERA
-        book getword pzPendingImfile $options:0 telescope -var TELESCOPE
-        book getword pzPendingImfile $options:0 class_id -var CLASS_ID
-        book getword pzPendingImfile $options:0 filename -var FILENAME
-
-	# we saved the workdir so we can pass it to pztool
-	$workdir = $options:1
-
-	# update the database with the fault state
-        $run = pztool -copydone -exp_name $EXP_NAME -inst $CAMERA -telescope $TELESCOPE -class $CLASS -class_id $CLASS_ID -uri $FILENAME -workdir $workdir -code $JOB_STATUS -end_stage reg
-
-        # create the command line
-        if ($VERBOSE > 1)
-          echo exec $run
-        end
-        exec $run
-
-	# update the pantasks process tables
-        process_exit pzPendingImfile $options:0 $JOB_STATUS
-    end
-
+    # operation timed out?
     task.exit timeout
         showcommand timeout
