METADATA_GETNATR Function

Returns the nth attribute of the specified object.

Syntax

rc = METADATA_GETNATR(uri, n, attr, value);

Required Arguments

uri (in)
specifies a Uniform Resource Identifier.
n (in)
specifies a numeric index value that indicates which row to return from the array; see Array Parameters.
attr (out)
returns the name of a metadata object attribute.
value (out)
returns the value of the specified attribute.

Return Values

n
The number of attributes for the URI.
-1
Unable to connect to the metadata server.
-2
No attributes are defined for the object.
-3
No objects match the URI.
-4
n is out of range.

Examples

Example 1: Using an Object URI

options metaserver="a123.us.company.com"
	metaport=8561
	metauser="myid"
	metapass="mypassword"
	metarepository="myrepos";

data _null_;
    length attr $256
    	   value $256;
    rc=1;
    n=1;
    do while(rc>0);

        /* Walk through all the attributes on this machine object. */

        rc=metadata_getnatr("omsobj:Machine?@Name='bluedog'",
                            n,
                            attr,
                            value);

        if (rc>0) then put n= attr= value=;

        n=n+1;

    end;
run;

Example 2: Using a Repository URI

options metaserver="a123.us.company.com"
	metaport=8561
	metauser="myid"
	metapass="mypassword"
	metarepository="myrepos";

data _null_;
    length id $20
	   type $256
	   attr $256
	   value $256;
	   
    rc=metadata_resolve("omsobj:RepositoryBase?@Name='myrepos'",type,id);

    put rc=;
    put id=;
    put type=;
    n=1;
    rc=1;
    do while(rc>=0);

       
rc=metadata_getnatr("omsobj:RepositoryBase?@Name='myrepos'",n,attr,value);
        if (rc>=0) then put attr= value=;
        n=n+1;
    end;
run;