Creating a namespace

To create a namespace, it might be easier to modify the sample programs. The following section describes the steps that are necessary to get a namespace running by modifying the samples provided with Duplicate Detect. To create a namespace without modifying the sample, use the namespace schema definition that is provided in the DupNamespace.xsd file.

The files that you need are provided in the FTM artifacts pod and must be downloaded from the pod. For more information about getting files from the artifacts container for your offering, see Getting the files from the artifacts container for your FTM offering.

  1. Make copies of the following files:
    • izhDupDetectDBrefload.bat
    Name each to be meaningful for the namespace that is being created. For this example, an _IN suffix is added to each file name.
  2. Make copies of the following files:
    • ReferenceDupPayment.ddl
    • ReferenceNamespaces.xml
    • ReferenceInsertNamespaces.ddl
    • ReferenceNamespaces.dat
    Name each to be meaningful for the namespace that is being created. For this example, an _IN suffix is added to each file name.
  3. Edit the izhDupDetectDBrefload_IN.bat file to reference the new DDL files, which must be customized for the new namespace.
    rem ===================
    rem Create the Sample tables 
    rem ===================
    db2 -tvf ReferenceDupPayment_IN.ddl
    
    rem ===================
    rem Load the Sample Namespace definitions
    rem ===================
    db2 -tvf ReferenceInsertNamespaces_IN.ddl
  4. Edit the ReferenceDupPayment_IN.ddl file to reference the new schema name for the new namespace. Modify the definition of the details table to contain the fields on which to do duplicate checking and any residual data to be sent. The SYS_ column definitions cannot be modified, they must be defined as they are.
    CREATE TABLE DUP_PAY_IN.UOW
    (
       SYS_UOW_ID          BIGINT          NOT NULL
                                           GENERATED ALWAYS AS IDENTITY,
       SYS_GROUP_ID        VARCHAR(64)     FOR MIXED DATA NOT NULL,
       SYS_UOW_NAME        VARCHAR(128)    FOR MIXED DATA WITH DEFAULT NULL,
       SYS_CLIENT_ID       VARCHAR(64)     FOR MIXED DATA WITH DEFAULT NULL,
       SYS_ENTERED_DATE    TIMESTAMP       WITH DEFAULT NULL,
       SYS_EXPIRY_DATE     TIMESTAMP       WITH DEFAULT NULL,
       SYS_UOW_SIZE        INTEGER         WITH DEFAULT NULL,
       SYS_REMAIN_ITEMS    INTEGER         WITH DEFAULT NULL,
       SYS_REMAIN_REVIEW   INTEGER         WITH DEFAULT NULL,
       SYS_REPLY_DEST      VARCHAR(2500)   FOR BIT DATA WITH DEFAULT NULL,
    
       CONSTRAINT UOW_PK PRIMARY KEY (SYS_UOW_ID)
    );
    
    CREATE UNIQUE INDEX DUP_PAY_IN.UOW_KEY ON DUP_PAY_IN.UOW
       (SYS_GROUP_ID ASC) ALLOW REVERSE SCANS;
    
    CREATE INDEX DUP_PAY_IN.UOW_EXPIRY ON DUP_PAY_IN.UOW
       (SYS_EXPIRY_DATE) ALLOW REVERSE SCANS;
    
    COMMIT;
    
    ------------------------------------------------------------------------
    -- Create DETAILS table and indices...
    ------------------------------------------------------------------------
    CREATE TABLE DUP_PAY_IN.DETAILS
    (
       SYS_ID             BIGINT         NOT NULL
                                         GENERATED ALWAYS AS IDENTITY,
       SYS_UOW_ID         BIGINT         NOT NULL,
       ACCOUNT            CHAR(20)       FOR MIXED DATA NOT NULL,
       ROUTING_TRANSIT    CHAR(20)       FOR MIXED DATA NOT NULL,
       AMOUNT             CHAR(14)       FOR MIXED DATA NOT NULL,
       PROCESS_CONTROL    CHAR(32)       FOR MIXED DATA WITH DEFAULT NULL,
       FIELD_4            CHAR(32)       FOR MIXED DATA WITH DEFAULT NULL,
       EXT_PROC_CODE      CHAR(32)       FOR MIXED DATA WITH DEFAULT NULL,
       AUX_ONUS           CHAR(32)       FOR MIXED DATA WITH DEFAULT NULL,
       PAYMENT_ID         BIGINT         WITH DEFAULT NULL,
       SOURCE             CHAR(20)       FOR MIXED DATA WITH DEFAULT NULL,
       BUS_DATE           TIMESTAMP      WITH DEFAULT NULL,
       BUS_CATEGORY       CHAR(32)       FOR MIXED DATA WITH DEFAULT NULL,
       ITEM_SEQ_SORTER    SMALLINT       WITH DEFAULT NULL,
       ITEM_SEQ_NUM       CHAR(12)       WITH DEFAULT NULL,
       CHANNEL            CHAR(32)       FOR MIXED DATA WITH DEFAULT NULL,
       SOURCE_COMP        CHAR(32)       FOR MIXED DATA WITH DEFAULT NULL,
       COLLECTION_TYPE    SMALLINT       WITH DEFAULT NULL,
       SYS_CLIENT_ADDR    VARCHAR(128)   FOR MIXED DATA WITH DEFAULT NULL,
       SYS_DUP            CHAR(1)        FOR MIXED DATA WITH DEFAULT NULL,
       SYS_ENTERED_DATE   TIMESTAMP      WITH DEFAULT NULL,
       SYS_EXPIRY_DATE    TIMESTAMP      WITH DEFAULT NULL,
       SYS_DELETED        TIMESTAMP      WITH DEFAULT NULL,
    
       CONSTRAINT DETAILS_PK PRIMARY KEY (SYS_ID)
    
    );
    
    CREATE INDEX DUP_PAY_IN.DETAILS_EXPIRY ON DUP_PAY_IN.DETAILS
       (SYS_EXPIRY_DATE) ALLOW REVERSE SCANS;
    
    CREATE INDEX DUP_PAY_IN.DETAILS_PKEY ON DUP_PAY_IN.DETAILS
       (ACCOUNT, ROUTING_TRANSIT, AMOUNT) ALLOW REVERSE SCANS;
    
    CREATE INDEX DUP_PAY_IN.UOW_DUP ON DUP_PAY_IN.DETAILS 
       (SYS_UOW_ID ASC, SYS_DUP DESC) ALLOW REVERSE SCANS;
    
    CREATE INDEX DUP_PAY_IN.DUP_ENTERED ON DUP_PAY_IN.DETAILS 
       (SYS_DUP ASC, SYS_ENTERED_DATE ASC) ALLOW REVERSE SCANS;
    
    --CREATE INDEX DUP_PAY_IN.DETAILS_ALLKEY ON DUP_PAY_IN.DETAILS
    --  (ACCOUNT, ROUTING_TRANSIT, AMOUNT, AUX_ONUS, PROCESS_CONTROL,
    --   PAYMENT_ID);
    
    COMMENT ON DUP_PAY_IN.DETAILS (
       ACCOUNT         IS 'PKEY',
       ROUTING_TRANSIT IS 'PKEY',
       AMOUNT          IS 'PKEY',
       AUX_ONUS        IS 'SKEY',
       PROCESS_CONTROL IS 'SKEY',
       PAYMENT_ID      IS 'RKEY',
       BUS_DATE        IS 'RKEY',
       BUS_CATEGORY    IS 'RKEY',
       ITEM_SEQ_SORTER IS 'RKEY',
       ITEM_SEQ_NUM    IS 'RKEY' );
    
    COMMIT;
    
    ------------------------------------------------------------------------
    -- Create DUPLICATE table and indices...
    ------------------------------------------------------------------------
    CREATE TABLE DUP_PAY_IN.DUPLICATE
    (
       SYS_ID                 BIGINT      NOT NULL,
       SYS_UOW_ID             BIGINT      NOT NULL,
       SYS_DUP_ID             BIGINT      WITH DEFAULT NULL,
       SYS_DUP                CHAR(1)     FOR MIXED DATA WITH DEFAULT NULL,
       SYS_ENTERED_DATE       TIMESTAMP   WITH DEFAULT NULL,
       SYS_EXPIRY_DATE        TIMESTAMP   WITH DEFAULT NULL,
       SYS_REVIEW_DATE        TIMESTAMP   WITH DEFAULT NULL,
       SYS_REVIEW_ID          CHAR(32)    FOR MIXED DATA WITH DEFAULT NULL,
       SYS_REVIEW_LOCK_ID     CHAR(32)    FOR MIXED DATA WITH DEFAULT NULL,
       SYS_REVIEW_LOCK_DATE   TIMESTAMP   WITH DEFAULT NULL,
       SYS_ERROR_CODE         CHAR(7)     WITH DEFAULT NULL,  
    
       CONSTRAINT DUP_PK PRIMARY KEY (SYS_ID)
    );
    
    CREATE INDEX DUP_PAY_IN.DUP_EXPIRY ON DUP_PAY_IN.DUPLICATE
       (SYS_EXPIRY_DATE) ALLOW REVERSE SCANS;
    
    CREATE INDEX DUP_PAY_IN.DUPLICATE_IDX1 ON DUP_PAY_IN.DUPLICATE
       (SYS_REVIEW_LOCK_ID, SYS_REVIEW_LOCK_DATE) ALLOW REVERSE SCANS;
    
    COMMIT;
  5. Edit the ReferenceInsertNamespaces_IN.ddl file to reference the schema name for the new namespace and load the namespace with the ReferenceNamespaces_IN.dat file.
    IMPORT FROM ReferenceNamespaces_IN.dat OF DEL LOBS FROM .  
    MODIFIED BY LOBSINFILE INSERT INTO DUPDETECT.NAMESPACE_DEFS;
    
    COMMIT;
  6. Edit the ReferenceNamespaces_IN.xml file to use the new schema name and make any changes, such as expiryCriteria, excludeCriteria, and autoDecisionCriteria, that are unique for this namespace.
    <?xml version="1.0" standalone="no"?>
    
     - Sample XML definition for populating the Db2 database for 
     - Duplicate Detect check processing domain.
    
    -->
    <namespace schema="DUP_PAY_IN" name="Duplicate Payment Table">
       <uowTable>UOW</uowTable>
       <detailsTable>DETAILS</detailsTable>
       <duplicateTable>DUPLICATE</duplicateTable>
       <reviewFlag>true</reviewFlag>
       <errorQueue>FXH.DUPLICATEDETECT.ERROR.QUEUE</errorQueue>
       <representmentThreshold>90 mins</representmentThreshold>
       <expiryCriterias>
    ...
    ...
  7. Edit the ReferenceNamespaces_IN.dat file to reference the new schema and namespace definition file.
    "DUP_PAY_IN","Duplicate Payment Table","ReferenceNamespaces_IN.xml"
  8. To create the new namespace DUP_PAY_IN, copy the files that you edited to where you can use them with your database. Open a Db2® command window and run izhDupDetectDBrefload_IN.bat.
  9. Restart the Duplicate Detect engine pod for the changes to the XML file to take effect.
  10. To use the newly created namespace in the user interface, permissions must be given to the namespace.