DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
DMI 2.0 code samples

Creating and managing attribute tables

This section shows how attributes can be defined as entries in a DMI table, with particular instances of each attribute within a table accessed via a key. It introduces the sample program phonebook and demonstrates some of the more advanced DMI commands and options available using rma2.

  1. To register the phonebook component, enter:

    cd /usr/src/dmi/samples/CI_support/phonebook
    ./phonebook &

  2. Go to the rma2 directory and examine the phonebook component's group structure by running rma2 to issue the DMI commands ListComponents and ListGroups. See ``Registering and managing components'' for more information.


    NOTE: Use your system's values for the phonebook ComponentID and Phone Book GroupID in the next step, if your values differ from those in the example.

  3. To list the Phone Book group's attributes, plus their values, enter:

    ./rma2 -x ListAttributes -c 5 -g 2000 -v

    You should see the following:

       ...
    Content = Attribute List
    ComponentName=Phone Book
    GroupName=Phone Book
    

    KeyValues StartValue 8336328 EndValue End

    Name=Telephone number AttributeID=1 Access=Read-Write Type=Integer StartValue 8336328 EndValue End

    Name=User Name AttributeID=2 Access=Read-Write Type=DisplayString(64)

    StartValue Bob EndValue End

    Name=Area AttributeID=3 Access=Read-Write Type=DisplayString(64)

    StartValue NY EndValue End


    NOTE: The attributes ``Telephone Number'', ``User Name'', and ``Area'' form a row of related values. Rows are then combined to form DMI tables. You can access individual or multiple table elements using the rma2 options -k key value and -r value=0, 1, 2, combined with the DMI commands SetAttribute, AddRow, and DeleteRow. (In this example, the telephone number is the key that uniquely identifies each row of data.)

  4. Experiment with using rma2 command options and DMI commands to view and change individual attributes and entire rows in phonebook. For example, to view the row after the one displayed in the previous step (which had a key value of 8336328), enter:

    ./rma2 -x ListAttributes -c 5 -g 2000 -v -k 8336328 -r 2

    The output should show the ``Telephone Number'' as ``8311788'', the ``User Name'' as ``John'' and the ``Area'' as ``Chicago''.

  5. To kill the phonebook process, enter:

    kill -2 process_ID.


NOTE: You might also like to experiment with viewing the phonebook attributes using a GUI management application such as Intel DMI Explorer. (See the DMI 2.0 SP Release Notes for further information.)


Next topic: Generating and consuming indications
Previous topic: Registering and managing components

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004