Index: /branches/eam_branch_20081124/Ohana/src/libdvo/src/dvo_catalog_mef.c
===================================================================
--- /branches/eam_branch_20081124/Ohana/src/libdvo/src/dvo_catalog_mef.c	(revision 20922)
+++ /branches/eam_branch_20081124/Ohana/src/libdvo/src/dvo_catalog_mef.c	(revision 20923)
@@ -27,4 +27,10 @@
   if (!gfits_scan (&catalog[0].header, "NMISS",    "%d", 1, &Nmissing)) return (FALSE);
   if (!gfits_scan (&catalog[0].header, "NSECFILT", "%d", 1, &Nsecfilt)) Nsecfilt = 0;
+
+  /* the OBJID is a counter that uniquely defines an average entry and never changes.  if
+     it is not defined for a legacy database, we can generate them using the existing index values.
+     XXX if it is missing, give an error and require the user to upgrade the DB? */
+  if (!gfits_scan (&catalog[0].header, "OBJID",    "%d", 1, &catalog[0].objID)) return (FALSE);
+  if (!gfits_scan (&catalog[0].header, "CATID",    "%d", 1, &catalog[0].catID)) return (FALSE);
 
   /* save the current number so we can do partial updates */
@@ -228,4 +234,5 @@
   gfits_modify (&catalog[0].header, "NSECFILT", "%d", 1, Nsecfilt);
   gfits_modify (&catalog[0].header, "EXTEND",   "%t", 1, TRUE);
+  gfits_modify (&catalog[0].header, "OBJID",    "%d", 1, catalog[0].objID);
 
   f = catalog[0].f;
Index: /branches/eam_branch_20081124/Ohana/src/libdvo/src/dvo_catalog_raw.c
===================================================================
--- /branches/eam_branch_20081124/Ohana/src/libdvo/src/dvo_catalog_raw.c	(revision 20922)
+++ /branches/eam_branch_20081124/Ohana/src/libdvo/src/dvo_catalog_raw.c	(revision 20923)
@@ -25,4 +25,10 @@
   if (!gfits_scan (&catalog[0].header, "NMISS",    "%d", 1, &catalog[0].Nmissing)) return (FALSE);
   if (!gfits_scan (&catalog[0].header, "NSECFILT", "%d", 1, &catalog[0].Nsecfilt)) catalog[0].Nsecfilt = 0;
+
+  /* the OBJID is a counter that uniquely defines an average entry and never changes.  if
+     it is not defined for a legacy database, we can generate them using the existing index values.
+     XXX if it is missing, give an error and require the user to upgrade the DB? */
+  if (!gfits_scan (&catalog[0].header, "OBJID",    "%d", 1, &catalog[0].objID)) return (FALSE);
+  if (!gfits_scan (&catalog[0].header, "CATID",    "%d", 1, &catalog[0].catID)) return (FALSE);
 
   /* determine catalog format */
@@ -249,4 +255,5 @@
   gfits_modify (&catalog[0].header, "NMISS",    "%d", 1, catalog[0].Nmissing);
   gfits_modify (&catalog[0].header, "NSECFILT", "%d", 1, catalog[0].Nsecfilt);
+  gfits_modify (&catalog[0].header, "OBJID",    "%d", 1, catalog[0].objID);
 
   /* specify the appropriate data format */
Index: /branches/eam_branch_20081124/Ohana/src/libdvo/src/dvo_catalog_split.c
===================================================================
--- /branches/eam_branch_20081124/Ohana/src/libdvo/src/dvo_catalog_split.c	(revision 20922)
+++ /branches/eam_branch_20081124/Ohana/src/libdvo/src/dvo_catalog_split.c	(revision 20923)
@@ -174,4 +174,10 @@
   if (!gfits_scan (&catalog[0].header, "NMISS",    "%d", 1, &Nmissing)) return (FALSE);
   if (!gfits_scan (&catalog[0].header, "NSECFILT", "%d", 1, &Nsecfilt)) Nsecfilt = 0;
+
+  /* the OBJID is a counter that uniquely defines an average entry and never changes.  if
+     it is not defined for a legacy database, we can generate them using the existing index values.
+     XXX if it is missing, give an error and require the user to upgrade the DB? */
+  if (!gfits_scan (&catalog[0].header, "OBJID",    "%d", 1, &catalog[0].objID)) return (FALSE);
+  if (!gfits_scan (&catalog[0].header, "CATID",    "%d", 1, &catalog[0].catID)) return (FALSE);
 
   /* save the current number so we can do partial updates */
@@ -512,4 +518,5 @@
   gfits_modify (&catalog[0].header, "NSECFILT", "%d", 1, Nsecfilt);
   gfits_modify (&catalog[0].header, "EXTEND",   "%t", 1, TRUE);
+  gfits_modify (&catalog[0].header, "OBJID",    "%d", 1, catalog[0].objID);
 
   /* in split mode, we can save only part of the data */ 
@@ -712,4 +719,5 @@
   gfits_modify (&catalog[0].header, "NSECFILT", "%d", 1, Nsecfilt);
   gfits_modify (&catalog[0].header, "EXTEND",   "%t", 1, TRUE);
+  gfits_modify (&catalog[0].header, "OBJID",    "%d", 1, catalog[0].objID);
 
   /* in split mode, we can save only part of the data */ 
@@ -890,4 +898,5 @@
   gfits_modify (&catalog[0].header, "NSECFILT", "%d", 1, Nsecfilt);
   gfits_modify (&catalog[0].header, "EXTEND",   "%t", 1, TRUE);
+  gfits_modify (&catalog[0].header, "OBJID",    "%d", 1, catalog[0].objID);
 
   /* in split mode, we can save only part of the data */ 
