Previous Page | Next Page

DATA Step Functions for Reading and Writing Metadata

METADATA_GETNOBJ Function

Returns the nth object that matches the specified URI.


Syntax

rc = METADATA_GETNOBJ(uri, n, nuri);


Arguments

Argument Direction Description
uri
in Uniform Resource Identifier
n
in Numeric index value that indicates which row to return from the array; see Array Parameters
nuri
out URI of the nth object that matches the input URI or matches a subtype object of the input URI


Return Values

Value Description
n
The number of objects and subtype objects that match the specified URI
-1 Unable to connect to the metadata server
-3 No objects match the specified URI
-4 n is out of range


Examples


Example 1 : Determining How Many Machine Objects Exist

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

data _null_;
    length uri $256;
    nobj=0;
    n=1;
   
    /* Determine how many machine objects are in this repository. */

    nobj=metadata_getnobj("omsobj:Machine?@Id contains '.'",n,uri);
    put nobj=;   /* Number of machine objects found. */
    put uri=;    /* URI of the first machine object. */

run;


Example 2 : Looping Through Each Repository on a Metadata Server

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

data _null_;
    length uri $256;
    nobj=1;
    n=1;
   
    /* Determine how many repositories are on this server. */

    do while(nobj >= 0);

        nobj=metadata_getnobj("omsobj:RepositoryBase?@Id contains '.'",n,uri);
        put nobj=;   /* Number of repository objects found. */
        put uri=;    /* Nth repository.                     */
        n=n+1;
    end;
run;


Related Functions

Previous Page | Next Page | Top of Page