NAME:
  recontarg
 PURPOSE:   (one line only)
  Add or update a specific RECON targeted occultation campaign
 DESCRIPTION:
 CATEGORY:
  Occultations
 CALLING SEQUENCE:
  recontarg,idx= or
  recontarg,jd=,objectid=
 INPUTS:
 OPTIONAL INPUT PARAMETERS:
 KEYWORD INPUT PARAMETERS:
  IDX - index value in the database.  JD and OBJECTID are ignored if this is
           provided.  This is NOT used for a new event to be added.  For that
           use the JD and OBTECTID keywords.

  JD - Julian Date (UT) of geocentric mid-time of appulse
  OBJECTID - Object code used by geteph (includes prefix), this must resolved
           to a valid ephemeris.

  The following keywords are relevant only when adding a new event.

  The next three keywords control the star picked up as the
    occultation target star.  This works best if the position is the catalog
    star position, not the position at epoch.  This is used to guide the
    Gaia catalog search and is not directly stored in the database.  The
    Gmag is not required but can help automatically find the star.  RA and
    DEC is used only if both are present.  If none of these are present,
    the geocentric position of the object at the input time is used to search
    the catalog.  Some times this leads to multiple hits and providing the
    magnitude can be the easiest way to latch onto the correct star.
  RA - catalog position of star (radians or string).
  DEC - catalog position of star (radians or string).

 The following keywords are always relevant.
  DBPIPE - LUN of an open pipe to a database connection.  If negative
              (default), this tool will open a connection for you at the
              start and then close just before returning.  Providing this
              can save time if making many calls to this routine in a row.
  EPHPIPE - LUN of an open pipe to a connection to geteph for ephemeris
              calculations.  If negative (default), this tool will open a
              connection for you at the start and then close it just before
              returning.  Useful for many calls to this tool.
  GTARG - Use this to overide the automatic system for estimating the
              apparent brightness of the target.

 The following keywords are relevant only for pre-existing events.
  REDOGAIA - Flag, if set will re-run the Gaia catalog search and update
                the star position.  This flag is irrelevant if a new record
                is needed.  This is provided to help support refreshing
                the prediction in the case of a new Gaia catalog release.
  FORCEUPDATE - Flag, if set will bypass any logic that decides if an
                  existing record should be updated.  Without this, an
                  update will be run only if it seems likely there's been
                  a change.
  ACTIVATE - Flag, if set, will re-activate an event.  This is ignored if
                there is no matching record that is marked in-active.
                If the re-activation is successsful, an update is considered
                and done if needed.
  DEACTIVATE - Flag, if set, will mark an active event as inactive.  This
                is ignored if there is no matching record.

 OUTPUTS:
   All output information goes either to the screen for positive feedback
     or to the "recon" database and the "targeted" table.
 KEYWORD OUTPUT PARAMETERS:
 CONFIGURATION:
 COMMON BLOCKS:
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
  Written by Marc W. Buie, Southwest Research Institute, 2024/03/24
  20024/07/076, MWB, futher development work