Index: /branches/eam_branches/ipp-20230313/Ohana/src/opihi/cmd.data/reindex.c
===================================================================
--- /branches/eam_branches/ipp-20230313/Ohana/src/opihi/cmd.data/reindex.c	(revision 42515)
+++ /branches/eam_branches/ipp-20230313/Ohana/src/opihi/cmd.data/reindex.c	(revision 42516)
@@ -13,4 +13,12 @@
     remove_argument (N, &argc, argv);
     KEEP_UNMATCH = TRUE;
+  }
+
+  // BLANKVAL is the name of the value to use for unmatched elements
+  char *BLANKVAL = NULL;
+  if ((N = get_argument (argc, argv, "-blank")) || (N = get_argument (argc, argv, "-blank-value"))) {
+    remove_argument (N, &argc, argv);
+    BLANKVAL = strcreate (argv[N]);
+    remove_argument (N, &argc, argv);
   }
 
@@ -35,4 +43,5 @@
     opihi_flt *vi = ivec[0].elements.Flt;
     opihi_int *vx = xvec[0].elements.Int;
+    opihi_flt myBlank = (BLANKVAL == NULL) ? NAN : atof(BLANKVAL);
     for (Npts = i = 0; i < xvec[0].Nelements; i++, vx++) {
       if (Npts >= NPTS) {
@@ -42,5 +51,5 @@
       if (*vx < 0) {
 	if (KEEP_UNMATCH) {
-	  ovec[0].elements.Flt[Npts] = NAN;
+	  ovec[0].elements.Flt[Npts] = myBlank;
 	  Npts++;
 	} 
@@ -55,4 +64,5 @@
     opihi_int *vi = ivec[0].elements.Int;
     opihi_int *vx = xvec[0].elements.Int;
+    opihi_int myBlank = (BLANKVAL == NULL) ? -4096 : atoi(BLANKVAL);
     for (Npts = i = 0; i < xvec[0].Nelements; i++, vx++) {
       if (Npts >= NPTS) {
@@ -62,5 +72,5 @@
       if (*vx < 0) {
 	if (KEEP_UNMATCH) {
-	  ovec[0].elements.Int[Npts] = -4096; // XXX use a different or a specified value?
+	  ovec[0].elements.Int[Npts] = myBlank;
 	  Npts++;
 	} 
@@ -74,4 +84,5 @@
   if (ivec->type == OPIHI_STR) {
     opihi_int *vx = xvec[0].elements.Int;
+    char *myBlank = (BLANKVAL == NULL) ? strcreate ("") : strcreate(BLANKVAL);
     for (Npts = i = 0; i < xvec[0].Nelements; i++, vx++) {
       if (Npts >= NPTS) {
@@ -90,12 +101,15 @@
       Npts++;
     }
+    FREE (myBlank);
   }
 
   // free up unused memory
   ResetVector (ovec, ivec->type, Npts);
+  FREE (BLANKVAL);
   return (TRUE);
 
 error:
   DeleteVector (ovec);
+  FREE (BLANKVAL);
   return (FALSE);
 
@@ -104,8 +118,10 @@
     gprint (GP_ERR, "  Creates a new vector (out) from (in) based on sequence in (index)\n");
     gprint (GP_ERR, "  output[i] = input[index[i]]\n");
-    gprint (GP_ERR, "  If -keep-unmatched is provided, elements of index with negative values will be set to NaN / -1,\n");
+    gprint (GP_ERR, "  If -keep-unmatched is provided, elements of index with negative values will be set to NaN / -4096 (or specific value)\n");
     gprint (GP_ERR, "    otherwise they will be skipped in the output.\n");
+    gprint (GP_ERR, "  If -blank-value is provided, this supplied value will be used for unmatched elements\n");
     gprint (GP_ERR, "  The output vector has the type of the input vector and the length of the index (if -keep-unmatched).\n");
     gprint (GP_ERR, "  The index vector may have duplicates\n");
+    FREE (BLANKVAL);
     return (FALSE);
 }
