Index: /trunk/pstamp/scripts/pstamp_finish.pl
===================================================================
--- /trunk/pstamp/scripts/pstamp_finish.pl	(revision 18639)
+++ /trunk/pstamp/scripts/pstamp_finish.pl	(revision 18640)
@@ -166,4 +166,5 @@
                 print STDERR "no reglist file for job $job_id\n" if $verbose;
                 print $tdf "$rownum|$fault|0|$job_id|";
+                print $tdf "0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|\n";
             }
         } else {
Index: /trunk/pstamp/scripts/pstampparse.pl
===================================================================
--- /trunk/pstamp/scripts/pstampparse.pl	(revision 18639)
+++ /trunk/pstamp/scripts/pstampparse.pl	(revision 18640)
@@ -69,5 +69,5 @@
 
 my $pstamptool  = can_run('pstamptool')  or (warn "Can't find pstamptool"  and $missing_tools = 1);
-my $lookup_images = can_run('pstampparse') or (warn "Can't find pstampparse" and $missing_tools = 1);
+my $locateimages = can_run('locateimages') or (warn "Can't find locateimages" and $missing_tools = 1);
 my $pstampdump  = can_run('pstampdump') or (warn "Can't find pstampdump" and $missing_tools = 1);
 my $fields  = can_run('fields') or (warn "Can't find fields" and $missing_tools = 1);
@@ -147,6 +147,6 @@
     my $stamp_name   = $row->{STAMP_NAME};
     my $filter   = $row->{FILTER};
-    my $date_min = $row->{DATE_MIN};
-    my $date_max = $row->{DATE_MAX};
+    my $mjd_min = $row->{MJD_MIN};
+    my $mjd_max = $row->{MJD_MAX};
     my $x = $row->{CENTER_X};
     my $y = $row->{CENTER_Y};
@@ -155,4 +155,7 @@
     my $coord_mask = $row->{COORD_MASK};
     my $option_mask= $row->{OPTION_MASK};
+
+    $stamp_name = "" if $stamp_name eq "null";
+    
 
     # XXX: TODO: don't die in this loop. If we encounter an error add a job with the proper fault
@@ -182,7 +185,4 @@
     }
 
-    die "region of interest is required for request type bycoord" 
-        if (($req_type eq "bycoord") && !defined($roi_string));
-
     die "region of interest is required to make postage stamps"
         if (($job_type eq "stamp") && !defined($roi_string));
@@ -190,8 +190,18 @@
     # find the uris for this request
 
-    # XXX: replace the invokcation of the hacked pstampparse with a new ippTool that finds
+    if ($req_type eq "bycoord") {
+        die "region of interest is required for request type bycoord" if !defined($roi_string) ;
+        die "center must be specified in sky coordintes for bycoord" 
+            if ($coord_mask & PSTAMP_CENTER_IN_PIXELS);
+        # replace the id with center coordinates
+        $id = "$x $y";
+    }
+
+    # XXX: replace the invokcation of the hacked locateimages with a new ippTool that finds
     # images/runs and prints out the uri and other metadata as a metadata config doc
 
-    my $command = "$lookup_images -dbname $image_db -$req_type $img_type $id $lookup_class_id";
+    my $command = "$locateimages -dbname $image_db -$req_type $img_type $id $lookup_class_id";
+    $command .= " -mjd_min $mjd_min" if ($mjd_min);
+    $command .= " -mjd_max $mjd_max" if ($mjd_max);
 
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
@@ -245,5 +255,6 @@
 
             $num++;
-            my $output_base = "$out_dir/${rownum}_${num}_${stamp_name}";
+            my $output_base = "$out_dir/${rownum}_${num}";
+            $output_base .= "_${stamp_name}" if $stamp_name;
 
             # XXX: TODO: here is where we need to check whether or not the source inputs still exist
