The problem of merging records into the main database in a coherent manner is not a trivial one. In particular, care must be taken that conflicting updates are not entered into the main database. The routine HDBMERG described below performs checks to ensure that at record to be merged into the database does not conflict with any updates already in the database that have been made since information upon which the new record is based was extracted from the main database.
Routine HDBMERG will merge a database or records from a database with a pre-existing `target' database. Depending on the options selected, all subdetector subdirectories or only a selected few may have their records merged. The subdetector-subdirectories to be merged are either specified by a full pathname in CHAUX, or else a path to the relevant subdetector-directory in CHAUX and a list of the selected subdetector-subdirectory names in the NSDIR elements of the CHARACTER vector CHSDIR. The ``target'' database is identified by the top-directory name given in CHTMAI .
The database which contains the records to be merged can be created with the HDBNEW. If the database has been created with the HDBEXTR routine only the records which have been stored in this database after calling HDBEXTR will be merged in. In the other case all records will be merged in. If the option X is specified the merged records are also written to an FZ file, but note that the appropriated FZ calls should have previously been issued before calling HDBMERG. By default a brief summary of all merged records is printed. This can be suppressed with option N. For expert use only there is the facility to change the range of applicability of the records on merging (option R).
+--------------------------------------------------------+ |CALL HDBMERG (PATHI,PATHO,KEYS,CHSDIR,NSECD,CHOPT,IRC*) | +--------------------------------------------------------+