Substituting data load attribute values with variables

You can substitute the values of most attributes in the wc-dataload.xml data load order configuration file and wc-dataload-env.xml data load environment configuration files. By using variable substitutions, you can change the value of attributes without editing the configuration file. For example, you can substitute the value of the user ID attribute for a variable.

About this task

Instead of using fixed attribute values in data load configuration files, you can use variable substitutions. The actual values for the variables are entered in the command line when the data load is run. If you do not enter a value for a variable when you run the data load, the utility prompts you to enter a value. You can also specify a default value for a variable. If you do not enter a value for a variable when you run the data load, the default value is used.
Consider the following possible issues when you perform this task:
  • When you substitute a variable for a password attribute, you must specify an encrypted password value. If you specify a plain text password, the Data Load utility tries to decrypt your password and fails to do so.
    Note: For the password attribute, you do not need to use a variable substitution. You can leave the value empty. When the data load runs, you are prompted to enter a password. The password that you enter can be a plain unencrypted password. For security reasons, the system does not echo the password value that is entered.
  • When you use a substitution variable for a numeric attribute field such as batch size or commit count, you must turn off XML validation because of the XSD validation problem. For more information about setting the -DXmlValidation parameter, see Data Load utility.
Note: Variable substitution is case-sensitive.

Procedure

  1. Open the configuration file that contains the attribute value you want to substitute for editing.
  2. Type a variable name in the space where the attribute value is expected. The format of a variable name is ${name}. You can also specify a default value in the format ${name,defaultValue}.
    The following examples include the database configuration properties that are in the wc-dataload.xml load order configuration file:
    • SolarisLinuxWindowsAIX<_config:Database type="db2" name="mall" user="userId" password="" port="50000" schema="USERID" server="localhost"/>
    • For IBM i OS operating system<_config:Database name="system1" password="" server="system1.abc.com" type="OS400" user="wcuser1" schema="wcuser1"/>
    These values can be substituted for the following variables:
    • SolarisLinuxWindowsAIX<_config:Database type="${dbType}" name="${dbName}" user="${dbUser}" password="" schema="${dbSchema}" server="${dbServerHost,localhost}" port="${dbPort}"/>
    • For IBM i OS operating system<_config:Database name="${dbName}" password="" server="${dbServerHost,localhost}" type="${dbType}" user="${dbUser}" schema="${dbSchema}"/>
    For IBM i OS operating systemNote: To use the IBM Toolbox for JDBC driver, the driverType property is needed. For example:
    <_config:Database name="system1" password="" server="system1.abc.com" type="OS400" driverType="toolbox" user="wcuser1" schema="wcuser1"/>
  3. To enter the actual values of the attributes, type -D in front of each parameter on the command line when they run the data load utility.
    For example:
    –DdbType=db2 –DdbName=mall -DdbUser=userId -DdbSchema=USERID -DdbServerHost=localhost -DdbPort=50000
    The -DdbServerHost=localhost parameter can be omitted because a default value is specified for the -DdbServerHost parameter.