---------------------------------------------------------------------------------------------
-- HB_Replicat.CDC.inc
-- Description - Include heartbeat tables in any Replicat process,
--               including performance monitoring tokens
--               CDC version - to be used where source/target database are the same
-- Differences - Do not replicate GGS_HEARTBEAT... would cause 'loopback' scenario, rows already there
--             - Option - include below line in COMAP to more clearly differentiate 'internal' processing?
--          SRC_DB         = @STRCAT (SRC_DB, "-internal"),
---------------------------------------------------------------------------------------------
MAP GGADMIN.HEARTBEAT,     TARGET GGADMIN.GGS_HEARTBEAT,
  KEYCOLS (SRC_DB, EXTRACT_NAME),
  INSERTMISSINGUPDATES,
  COLMAP (USEDEFAULTS,
          ID = 0,
          SOURCE_COMMIT  = @GETENV ("GGHEADER", "COMMITTIMESTAMP"),
          EXTRACT_NAME   = @TOKEN ("CAPGROUP"),
          CAPTIME        = @TOKEN ("CAPTIME"),
          PMPGROUP       = @TOKEN ("PMPGROUP"),
          PMPTIME        = @TOKEN ("PMPTIME"),
          DELGROUP       = @GETENV ("GGENVIRONMENT", "GROUPNAME"),
          DELTIME        = @DATE ("YYYY-MM-DD HH:MI:SS.FFFFFF","JTSLCT",@GETENV ("JULIANTIMESTAMP")),
          EDDLDELTASTATS = @TOKEN ("EDDLDELTASTATS"),
          EDMLDELTASTATS = @TOKEN ("EDMLDELTASTATS"),
          RDDLDELTASTATS = @GETENV ("DELTASTATS", "DDL"),
          RDMLDELTASTATS = @GETENV ("DELTASTATS", "DML")
         );
MAP GGADMIN.HEARTBEAT,     TARGET GGADMIN.GGS_HEARTBEAT_HISTORY,
  KEYCOLS (ID),
  INSERTALLRECORDS,
  COLMAP (USEDEFAULTS,
          ID = 0,
          SOURCE_COMMIT  = @GETENV ("GGHEADER", "COMMITTIMESTAMP"),
          EXTRACT_NAME   = @TOKEN ("CAPGROUP"),
          CAPTIME        = @TOKEN ("CAPTIME"),
          PMPGROUP       = @TOKEN ("PMPGROUP"),
          PMPTIME        = @TOKEN ("PMPTIME"),
          DELGROUP       = @GETENV ("GGENVIRONMENT", "GROUPNAME"),
          DELTIME        = @DATE ("YYYY-MM-DD HH:MI:SS.FFFFFF","JTSLCT",@GETENV ("JULIANTIMESTAMP")),
          EDDLDELTASTATS = @TOKEN ("EDDLDELTASTATS"),
          EDMLDELTASTATS = @TOKEN ("EDMLDELTASTATS"),
          RDDLDELTASTATS = @GETENV ("DELTASTATS", "DDL"),
          RDMLDELTASTATS = @GETENV ("DELTASTATS", "DML")
         );
---------------------------------------------------------------------------------------------