Index: trunk/pstamp/scripts/detect_query_read
===================================================================
--- trunk/pstamp/scripts/detect_query_read	(revision 18587)
+++ trunk/pstamp/scripts/detect_query_read	(revision 27788)
@@ -78,10 +78,16 @@
                         comment => 'site identifier (MPC observatory code)',
                         value => undef
-              }
+                      },
+ 	'STAGE'    => { 
+	                name => 'STAGE',
+			writetype => TSTRING,
+			comment => 'processing stage to examine',
+			value => undef
+	              }
 };
 
 # key_array insures that the order that the keywords is printed out is
 # the same as the ICD
-my @key_array = qw( QUERY_ID FPA_ID MJD_OBS FILTER OBSCODE );
+my @key_array = qw( QUERY_ID FPA_ID MJD_OBS FILTER OBSCODE STAGE);
 
 # Specification of columns
@@ -144,4 +150,7 @@
         my $name = $header->{$key}->{name};
         my $value = $inHeader->{$name};
+	if (($key eq 'STAGE')&& !(defined($value))) {
+	    $value = 'DIFF';
+	}
         # get rid of quotes and whitespace
         $value =~ s/\'//g;
