Index: trunk/Ohana/src/opihi/dvo/avextract.c
===================================================================
--- trunk/Ohana/src/opihi/dvo/avextract.c	(revision 33662)
+++ trunk/Ohana/src/opihi/dvo/avextract.c	(revision 33963)
@@ -37,4 +37,11 @@
   }
 
+  int VERBOSE2 = FALSE;
+  if ((N = get_argument (argc, argv, "-vv"))) {
+    remove_argument (N, &argc, argv);
+    VERBOSE = TRUE;
+    VERBOSE2 = TRUE;
+  }
+
   int PARALLEL = FALSE;
   if ((N = get_argument (argc, argv, "-parallel"))) {
@@ -65,4 +72,13 @@
       return FALSE;
     }    
+  }
+
+  // this is used to NOT save the results in the results file
+  // use this option when mextract is used in a script which does its
+  // own job of packaging the results
+  int SKIP_RESULTS = FALSE;
+  if ((N = get_argument (argc, argv, "-skip-results"))) {
+    remove_argument (N, &argc, argv);
+    SKIP_RESULTS = TRUE;
   }
 
@@ -80,4 +96,7 @@
     goto escape; 
   }
+
+  // init locally static variables (time refs)
+  dbExtractAveragesInit (); 
 
   // command-line is of the form: avextract field,field, field [where (field op value)...]
@@ -173,7 +192,5 @@
     catalog.filename = (HOST_ID || PARALLEL_LOCAL) ? hostfile : skylist[0].filename[i];
     catalog.catflags = LOAD_AVES | LOAD_SECF;
-    if (needMeasures) {
-      catalog.catflags |= LOAD_MEAS;
-    }
+    catalog.catflags |= needMeasures ? LOAD_MEAS : SKIP_MEAS;
     catalog.Nsecfilt = 0;
 
@@ -181,5 +198,5 @@
       
     // an error exit status here is a significant error
-    if (!dvo_catalog_open (&catalog, NULL, FALSE, "r")) {
+    if (!dvo_catalog_open (&catalog, NULL, VERBOSE2, "r")) {
       gprint (GP_ERR, "ERROR: failure to open catalog file %s\n", catalog.filename);
       exit (2);
@@ -193,6 +210,6 @@
       m = catalog.average[j].measureOffset;
 
-      // reset counters for saved fields, extract fields
-      dbExtractAveragesInit (); 
+      dbExtractAveragesInitAve ();  // reset counters for saved fields (costs very little)
+
       for (n = 0; n < Nfields; n++) {
 	values[n] = dbExtractAverages (&catalog.average[j], &catalog.secfilt[j*Nsecfilt], &catalog.measure[m], &fields[n]);
@@ -229,7 +246,9 @@
 
   // write vectors to a table (this is used by parallel dvo operations, but can be used elsewhere)
-  if (RESULT_FILE) {
+  if (RESULT_FILE && !SKIP_RESULTS) {
     int status = WriteVectorTableFITS (RESULT_FILE, "RESULT", vec, Nreturn, FALSE, NULL);
-    if (!status) goto escape;
+    if (!status) {
+      goto escape;
+    }
   }
 
