Index: /trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm
===================================================================
--- /trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm	(revision 35499)
+++ /trunk/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm	(revision 35500)
@@ -471,5 +471,5 @@
         $base_name    = "path_base"; # name of the field for the warptool output
     } elsif ($stage eq "diff") {
-        # XXX: is this path ever used for diff images anymore?
+
         if ($component or $use_imfile_id or !$skycenter) {
             $command = "$difftool -diffskyfile -pstamp_order -dbname $imagedb";
@@ -490,4 +490,6 @@
         $psf_name    = "PSPHOT.PSF.SKY.SAVE";
         $base_name   = "path_base";
+        my $diff_mode = getDiffMode($row->{RUN_TYPE});
+        $command .= " -diff_mode $diff_mode" if $diff_mode;
     } elsif ($stage eq "stack") {
         $skycell_id = $component;
@@ -735,5 +737,5 @@
 
     my $command = "$difftool -dbname $imagedb -pstamp_order";
-    
+
     my $choose_components = 0;
     if ($byid) {
@@ -751,4 +753,7 @@
     }
 
+    my $diff_mode = getDiffMode($rowList->[0]->{RUN_TYPE});
+    $command .= " -diff_mode $diff_mode" if $diff_mode;
+    
     my $output = runToolAndParse($command, $verbose);
 
@@ -1836,4 +1841,23 @@
 }
 
+sub getDiffMode {
+    my $run_type = shift;
+    my $diff_mode;
+    if (!isnull($run_type)) {
+        $run_type = lc($run_type);
+        if ($run_type eq 'warp_warp') {
+            $diff_mode = 1;
+        } elsif ($run_type eq 'warp_stack') {
+            $diff_mode = 2;
+        } elsif ($run_type eq 'stack_stack') {
+            $diff_mode = 4;
+        } else {
+            print STDERR "Ingnoring unrecognized diff RUN_TYPE : $run_type\n";
+        }
+    }
+    return $diff_mode;
+}
+        
+
 sub my_die
 {
