Configure a variable map

 

This example creates a variable map to an existing server.

  1. Idenitfy the server and assign it to the server variable.

    set server [$AdminConfig getid /Cell:cellname/Node:nodename/Server:server2/]
    

  2. Create an empty variable map for the server and assign it to the varMap variable.

    set varMap [$AdminConfig create VariableMap $server {}]
    

    This example is to create a variable map. If your server already has an existing variable map, then you can use the following to get its configuration object:

    set varMap [$AdminConfig getid /Cell:cellname/Node:nodename/Server:server2/VariableMap:/]
    

  3. Set up variable map entry attributes.

    In the following example, you create variable map entries DB2_INSTALL_ROOT and DB2_LIB_DIR. DB2_LIB_DIR is going to refer back to DB2_INSTALL_ROOT:

    set nameattr1 [list symbolicName DB2_INSTALL_ROOT]
    set valattr1 [list value "/usr/local/db2/sqllib"]
    set nameattr2 [list symbolicName DB2_LIB_DIR]
    set valattr2  [list value  "\${DB2_INSTALL_ROOT}/lib"]
    set attr1 [list $nameattr1 $valattr1]
    set attr2 [list $nameattr2 $valattr2]
    set attrs [list $attr1 $attr2]
    

    Example output:

    {{symbolicName DB2_INSTALL_ROOT} {value /usr/local//db2/sqllib}} {{symbolicName DB2_LIB_DIR} {value {${DB2_INSTALL_ROOT}/lib}}}
    

  4. Modify the entries attribute in the variable map to add the two new entries.

    $AdminConfig modify $varMap [subst {{entries {$attrs}}}]
    

  5. To view the variable map:

    $showall $varMap
    
    Example output:

    {entries {{{symbolicName DB2_INSTALL_ROOT}
    {value /usr/local/db2/sqllib}} {{symbolicName DB2_LIB_DIR}
    {value ${DB2_INSTALL_ROOT}/lib}}}}
    

  6. Save changes:

    $AdminConfig save