Index: /trunk/pstamp/scripts/pstamp_finish.pl
===================================================================
--- /trunk/pstamp/scripts/pstamp_finish.pl	(revision 20255)
+++ /trunk/pstamp/scripts/pstamp_finish.pl	(revision 20256)
@@ -140,8 +140,8 @@
             # we've included parse_results.txt to the fileset if it exists
             #
-            my $rownum = 1;
+            my $rownum = 0;
             my $fault = 42; # get a real error code
             print $tdf "$rownum|$fault|0|0|";
-            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";
+            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|\n";
         } else {
             my $metadata = $mdcParser->parse($output) or die("Unable to parse metdata config doc");
Index: /trunk/pstamp/scripts/pstamp_revert_request.pl
===================================================================
--- /trunk/pstamp/scripts/pstamp_revert_request.pl	(revision 20255)
+++ /trunk/pstamp/scripts/pstamp_revert_request.pl	(revision 20256)
@@ -41,4 +41,6 @@
 
 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
+
+pod2usage ( -msg => "--req_id is required", -exitval => 2 ) if !$req_id;
 
 my $missing_tools;
Index: /trunk/pstamp/scripts/pstampparse.pl
===================================================================
--- /trunk/pstamp/scripts/pstampparse.pl	(revision 20255)
+++ /trunk/pstamp/scripts/pstampparse.pl	(revision 20256)
@@ -123,4 +123,5 @@
 }
 
+my $num_jobs = 0;
 foreach my $row (@$rows) {
     my $rownum   = $row->{ROWNUM};
@@ -131,5 +132,4 @@
     my $id       = $row->{ID};
     my $class_id = $row->{CLASS_ID};
-    my $stamp_name   = $row->{STAMP_NAME};
     my $filter   = $row->{REQFILT};
     my $mjd_min = $row->{MJD_MIN};
@@ -142,5 +142,4 @@
     my $option_mask= $row->{OPTION_MASK};
 
-    $stamp_name = "" if $stamp_name eq "null";
     $class_id = "" if ($class_id eq "null" or $class_id eq "all");
     
@@ -193,6 +192,6 @@
 
     if (!$images) {
-        print STDERR "no matching images found\n";
-        exit $PS_EXIT_DATA_ERROR;
+        print STDERR "no matching images found for row $rownum\n";
+        next;
     }
     if ($mode eq "list_uri") {
@@ -223,4 +222,5 @@
         }
         close LISTFILE;
+        $num_jobs++;
         my $command = "$pstamptool -addjob -req_id $req_id -job_type get_image"
                     . " -uri $listfile -outputBase $out_dir -rownum $rownum";
@@ -255,7 +255,4 @@
             my $output_base = "$out_dir/${rownum}_${job_num}";
 
-            # By commenting out the next line, I hereby drop the use of STAMP_NAME
-            # $output_base .= "_${stamp_name}" if $stamp_name;
-
             # add astrometry file for raw and chip images if one is available
             if (($img_type eq "chip") || ($img_type eq "raw")) {
@@ -281,4 +278,5 @@
             my $state = "run";
 
+            $num_jobs++;
             my $command = "$pstamptool -addjob -req_id $req_id -job_type $job_type"
                 . " -uri $uri -outputBase $output_base -args '$args' -rownum $rownum"
@@ -307,3 +305,13 @@
 }
 
-exit 0;
+if ($mode eq "queue_jobs") {
+    if ($num_jobs) {
+        exit 0;
+    } else {
+        # no jobs queued return error to get the request stopped
+        # TODO: need to define meaningful error codes
+        exit $PS_EXIT_UNKNOWN_ERROR;
+    }
+} else {
+    exit 0;
+}
