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.
db2 -stf bankingCreateSettings.db2
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.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 ));