Index: trunk/Ohana/src/dvomerge/include/dvomerge.h
===================================================================
--- trunk/Ohana/src/dvomerge/include/dvomerge.h	(revision 40376)
+++ trunk/Ohana/src/dvomerge/include/dvomerge.h	(revision 40377)
@@ -55,4 +55,6 @@
 int    MATCH_BY_EXTERN_ID;
 
+int    ONLY_MATCHES;
+
 int    MATCHED_TABLES;
 int    RESET_STARPAR;
Index: trunk/Ohana/src/dvomerge/src/args.c
===================================================================
--- trunk/Ohana/src/dvomerge/src/args.c	(revision 40376)
+++ trunk/Ohana/src/dvomerge/src/args.c	(revision 40377)
@@ -86,8 +86,14 @@
   }
 
-  /* extra error messages */
+  /* match images in the src and tgt database tables by their externID values (otherwise by time and photcode) */
   MATCH_BY_EXTERN_ID = FALSE;
   if ((N = get_argument (*argc, argv, "-match-by-extern-id"))) {
     MATCH_BY_EXTERN_ID = TRUE;
+    remove_argument (N, argc, argv);
+  }
+  /* add objects from input to output database only if they match an existing object */
+  ONLY_MATCHES = FALSE;
+  if ((N = get_argument (*argc, argv, "-only-matches"))) {
+    ONLY_MATCHES = TRUE;
     remove_argument (N, argc, argv);
   }
@@ -373,8 +379,14 @@
   }
 
-  /* extra error messages */
+  /* match images in the src and tgt database tables by their externID values (otherwise by time and photcode) */
   MATCH_BY_EXTERN_ID = FALSE;
   if ((N = get_argument (*argc, argv, "-match-by-extern-id"))) {
     MATCH_BY_EXTERN_ID = TRUE;
+    remove_argument (N, argc, argv);
+  }
+  /* add objects from input to output database only if they match an existing object */
+  ONLY_MATCHES = FALSE;
+  if ((N = get_argument (*argc, argv, "-only-matches"))) {
+    ONLY_MATCHES = TRUE;
     remove_argument (N, argc, argv);
   }
Index: trunk/Ohana/src/dvomerge/src/dvomergeUpdate_catalogs.c
===================================================================
--- trunk/Ohana/src/dvomerge/src/dvomergeUpdate_catalogs.c	(revision 40376)
+++ trunk/Ohana/src/dvomerge/src/dvomergeUpdate_catalogs.c	(revision 40377)
@@ -330,4 +330,5 @@
     if (MATCHED_TABLES)      { strextend (&command, "-matched-tables"); }
     if (MATCH_BY_EXTERN_ID)  { strextend (&command, "-match-by-extern-id"); }
+    if (ONLY_MATCHES)        { strextend (&command, "-only-matches"); }
     if (UPDATE_CATFORMAT)    { strextend (&command, "-update-catformat %s", UPDATE_CATFORMAT); }
     if (UPDATE_CATCOMPRESS)  { strextend (&command, "-update-catcompress %s", UPDATE_CATCOMPRESS); }
Index: trunk/Ohana/src/dvomerge/src/merge_catalogs_old.c
===================================================================
--- trunk/Ohana/src/dvomerge/src/merge_catalogs_old.c	(revision 40376)
+++ trunk/Ohana/src/dvomerge/src/merge_catalogs_old.c	(revision 40377)
@@ -406,5 +406,5 @@
   /** incorporate unmatched image stars, if this star is in field of this catalog **/
   /* these new entries are all written out in UPDATE mode */ 
-  for (i = 0; i < Nstars; i++) {
+  for (i = 0; (i < Nstars) && !ONLY_MATCHES; i++) {
     off_t N = N1[i];
 
