Defining logical data specifications and Clustering settings

In this exercise, you create values of type DM_ClusSettings that include a value of type DM_LogicalDataSpec, and you insert them into the table IDMMX.ClusSettings.

The sample script contains INSERT statements to build a DM_ClusSettings value that consists of the following: The field names in the DM_LogicalDataSpec values are different in each statement. The DM_LogicalDataSpec value is also constructed in different ways.
Use the following command to run the sample script bankingCreateSettings.db2 to create DM_ClusSettings values and insert them into the table IDMMX.ClusSettings:
db2 -stf bankingCreateSettings.db2
The sample script bankingCreateSettings.db2 contains the following INSERT statement to construct the DM_LogicalDataSpec value from the DM_MiningData value contained in the IDMMX.MININGDATA table. The field names in the DM_LogicalDataSpec value are the same as the column names in the BANKCUSTOMERS table. The field 'GENDER' is removed from the generated DM_LogicalDataSpec.

INSERT INTO IDMMX."CLUSSETTINGS"
SELECT
    'BankingClusSettings',
    IDMMX.DM_ClusSettings()..
    DM_useClusDataSpec("MININGDATA"..DM_genDataSpec()..
                       DM_remDataSpecFld( 'GENDER' ) )..
    DM_setMaxNumClus(9)..
    DM_setFldUsageType( 'NO_DEBIT_TRANS', 2 )
FROM IDMMX."MININGDATA" where "ID"='AliasEqualToColumn';
The following INSERT statement constructs the DM_LogicalDataSpec value from the DM_MiningData value contained in the IDMMX.MININGDATA table. Some field names in the DM_LogicalDataSpec value are different from the column names in the BANKCUSTOMERS table.
The DM_LogicalDataSpec value contains as field names the alias names that were specified in the DM_MiningData value that was used. The use of alias names that are different from the column names amounts to a renaming of the columns, because the settings contain only the alias names. The model later contains both names, but it is possible to extract only alias names using the methods that are available.
INSERT INTO IDMMX."CLUSSETTINGS" SELECT
    'BankingClusAliasSettings',
    IDMMX.DM_ClusSettings()..
    DM_useClusDataSpec("MININGDATA".. DM_genDataSpec()..
                       DM_remDataSpecFld( 'CUSTNO' ) )..
    DM_setMaxNumClus(9)..
    DM_setFldUsageType( 'JOB', 2 )
FROM IDMMX."MININGDATA" where "ID"='AliasDifferentToColumn';
The following INSERT statement constructs the DM_LogicalDataSpec value using the method DM_addDataSpecFld. Use this approach to build generic settings which can be combined with different DM_MiningData values when task values are constructed:
INSERT INTO IDMMX."CLUSSETTINGS" VALUES (
    'BankingClusGenericSettings',
    IDMMX.DM_ClusSettings()..
    DM_useClusDataSpec( IDMMX.DM_LogicalDataSpec()..
                        DM_addDataSpecFld('AGEYEARS')..
                        DM_addDataSpecFld('MARITALSTATUS')..
                        DM_addDataSpecFld('LOYALTY')..
                        DM_addDataSpecFld('SAVINGSACCOUNT')..
                        DM_addDataSpecFld('AVERAGEBALANCE')..
                        DM_addDataSpecFld('JOB')..
                        DM_setFldType('AGEYEARS', 1 )..
                        DM_setFldType('MARITALSTATUS', 0 )..
                        DM_setFldType('LOYALTY', 1 )..
                        DM_setFldType('SAVINGSACCOUNT', 0 )..
                        DM_setFldType('AVERAGEBALANCE', 1 )..
                        DM_setFldType('JOB',0)
                        )..
    DM_setMaxNumClus(9)..
    DM_setFldUsageType( 'JOB', 2 ));


Feedback | Information roadmap