Index: trunk/pstamp/scripts/pstamp_listjobs.pl
===================================================================
--- trunk/pstamp/scripts/pstamp_listjobs.pl	(revision 18243)
+++ trunk/pstamp/scripts/pstamp_listjobs.pl	(revision 18247)
@@ -8,4 +8,13 @@
 use warnings;
 use strict;
+use Getopt::Long qw( GetOptions );
+
+my $verbose;
+my $dbname;
+
+GetOptions(
+    'verbose'   =>  \$verbose,
+    'dbname=s'  =>  \$dbname,
+);
 
 if (@ARGV != 1) {
@@ -15,5 +24,4 @@
 my $request_id = $ARGV[0];
 
-my $verbosity = 0;
 
 use Sys::Hostname;
@@ -21,5 +29,5 @@
 
 ## This isn't a script to be launched by pantasks we probably want go get rid of this
-if ($verbosity) {
+if ($verbose) {
     print STDERR "\n\n";
     print STDERR "Starting script $0 on $host\n\n";
@@ -59,6 +67,7 @@
 {
     my $command = "$pstamptool -listjob -req_id $request_id";
+    $command .= " -dbname $dbname" if $dbname;
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-        run(command => $command, verbose => $verbosity);
+        run(command => $command, verbose => $verbose);
     unless ($success) {
         die("Unable to perform pstamptool -pendingreq: $error_code");
Index: trunk/pstamp/scripts/pstamp_queue_requests.pl
===================================================================
--- trunk/pstamp/scripts/pstamp_queue_requests.pl	(revision 18243)
+++ trunk/pstamp/scripts/pstamp_queue_requests.pl	(revision 18247)
@@ -17,8 +17,10 @@
 my $verbose;
 my $dbname;
+my $limit;
 
 GetOptions(
     'verbose'       =>  \$verbose,
     'dbname=s'      =>  \$dbname,
+    'limit=s'       =>  \$limit,
 );
 
Index: trunk/pstamp/scripts/pstamp_webrequest.pl
===================================================================
--- trunk/pstamp/scripts/pstamp_webrequest.pl	(revision 18243)
+++ trunk/pstamp/scripts/pstamp_webrequest.pl	(revision 18247)
@@ -68,5 +68,5 @@
 # if -list is used, it must be the first argument
 my $listMode;
-if ($ARGV[0] eq "-list" ) {
+if ($ARGV[0] eq "-list_uri" ) {
     $listMode=1;
 } else  {
@@ -92,5 +92,6 @@
     ### In list mode just parse the file print the output and we're done
     ###
-    my $command = "$pstampparse $request_file";
+    ### XXX TODO: I shouldn't need this -mode list_uri since it's in the request file
+    my $command = "$pstampparse -mode list_uri $request_file";
     $command .= " -dbname $dbname" if $dbname;
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
Index: trunk/pstamp/src/pstampfinish.c
===================================================================
--- trunk/pstamp/src/pstampfinish.c	(revision 18243)
+++ trunk/pstamp/src/pstampfinish.c	(revision 18247)
@@ -26,4 +26,5 @@
     psString    dsRoot;
     psString    dsProduct;
+    psString    dbName;
     int         exitStatus;
 } psrfOptions;
@@ -70,4 +71,6 @@
         return NULL;
     }
+    psBool status;
+    options->dbName = psMetadataLookupStr(&status, options->config->complete, "DBNAME");
 
     if ((argnum = psArgumentGet(argc, argv, "-mode"))) {
@@ -265,8 +268,10 @@
     psString command = NULL;
 
-    psStringAppend(&command, "dsreg --add --type PSRESULTS --product %s --fileset %s", 
-            options->dsProduct, fileset_id);
-
-    printf("command is: %s\n", command);
+    psStringAppend(&command, "dsreg --dbname %s --add --type PSRESULTS --product %s --fileset %s", 
+            options->dbName, options->dsProduct, fileset_id);
+
+    if (options->verbose) {
+        fprintf(stderr, "command is: %s\n", command);
+    }
 
     // open a pipe to dsreg and set up the output fileset
Index: trunk/pstamp/src/pstampparse.c
===================================================================
--- trunk/pstamp/src/pstampparse.c	(revision 18243)
+++ trunk/pstamp/src/pstampparse.c	(revision 18247)
@@ -64,4 +64,6 @@
     }
 
+    // XXX: need to sort out the interactions of this mode option and the JOB_TYPE
+    // listed in the request file.
     if ((argnum = psArgumentGet(argc, argv, "-mode"))) {
         psArgumentRemove(argnum, &argc, argv);
@@ -629,4 +631,12 @@
         psStringAppend(&cmd, " -args '%s'", commandArgs);
     }
+    // XXX We may want to have the data store name be different than the default DB
+    psBool status;
+    psString dbName = psMetadataLookupStr(&status, options->config->complete, "DBNAME");
+    fprintf(stderr, "\n\n   dbName is %s\n", dbName);
+    if (dbName) {
+        psStringAppend(&cmd, " -dbname %s", dbName);
+    }
+
     psStringAppend(&cmd, " > /dev/null");
 
Index: trunk/pstamp/web/request.php
===================================================================
--- trunk/pstamp/web/request.php	(revision 18243)
+++ trunk/pstamp/web/request.php	(revision 18247)
@@ -1,8 +1,10 @@
 <?php 
 
+// prototype postage stamp server web interface
+
 // A php program that generates a postage stamp request form
 
-// There are two modes on the form List Images simply lists the input images that match
-// the image selection critera
+// There are two modes on the form List Images simply lists the input images
+// that match the image selection critera
 
 // When make stamps is selected when the page is posted, a postage stamp request is queued.
@@ -12,6 +14,15 @@
 // The mode for the page is given by $request_id != 0
 
-$COMMAND_DIR = "/export/data0/bills/src/ipp/pstamp/scripts";
+// XXX This is just a prototype for testing purposes. 
+
+
+// BEGIN Local configuration
+
+$COMMAND_DIR = "/export/data0/bills/psconfig/debug.linrh64/bin";
 $dsroot = "/export/data1/datastore/dsroot";
+$dbname = "simtest";
+
+// END Local configuration 
+//      (actually there is a little bit more in $COMMAND_DIR/pstamp_runcommand.sh )
 
 // Initialize variables
@@ -213,15 +224,21 @@
     global $rvar_id, $rvar_class_id;
     global $command_line;
-
+    global $dbname;
+
+    $making_stamps = 1;
     $cmd = "pstamp_runcommand.sh pstamp_webrequest.pl";
 
-    $making_stamps = 1;
+    // NOTE: If it is used, -list_uri must be the first argument to pstamp_webrequest.pl 
     
     if ($list_checked) {
-        $cmd .= " -list";
+        $cmd .= " -list_uri";
         $making_stamps = 0;
     } else if ($get_checked) {
         $making_stamps = 0;
         $cmd .= " -get_image";
+    }
+
+    if ($dbname) {
+        $cmd .= " --dbname $dbname";
     }
 
@@ -291,8 +308,8 @@
 
     if (($rvar_img_type == "raw") || ($rvar_img_type == "chip")) {
-        if (! $rvar_class_id ) {
-            throw new Exception("must specify Class ID with Image Type $rvar_img_type.");
-        }
-        if ($rvar_class_id = "all") {
+#        if (! $rvar_class_id ) {
+#            throw new Exception("must specify Class ID with Image Type $rvar_img_type.");
+#        }
+        if ((!$rvar_class_id) || ($rvar_class_id = "all")) {
             $cmd .= " null";
         } else {
@@ -402,4 +419,9 @@
 
     $command_line = "pstamp_runcommand.sh pstamp_listjobs.pl $request_id";
+    global $dbname;
+    if ($dbname) {
+        $command_line .= " --dbname $dbname";
+    }
+
     run_command($command_line);
     if ($jobFinished) {
@@ -429,6 +451,10 @@
     global $output_array;
     global $outFileset;
+    global $dbname;
 
     $command_line = "pstamp_runcommand.sh pstamptool -listreq -req_id $request_id -simple";
+    if ($dbname) {
+        $command_line .= " -dbname $dbname";
+    }
     run_command($command_line);
     if ($command_status == 0) {
