Previous Page | Next Page

Metadata API Class

_SET_SECONDARY_REPOSITORY_



Attaches to a secondary metadata repository
Category: Repository Methods

Syntax
Parameters
Details
Using _SET_SECONDARY_REPOSITORY_
Example: Set a Secondary Repository
See Also

Syntax

CALL SEND(i_api, '_SET_SECONDARY_REPOSITORY_', l_rc, l_meta, repos_id, <already>);

Parameters

Parameter Type Description
i_api Class specifies the passed instance of METAAPI.CLASS. See Using the Metadata API Class.
l_rc N specifies the return codes for the method. A nonzero code indicates failure and means that l_rc is an error list identifier. For the error list format, see Error Codes.
l_meta L specifies the passed metadata property list for the secondary repository that is to be set.
repos_id C specifies the returned repository ID for the secondary metadata repository that was set. For details about the repository ID parameter, see Identifying Metadata.
already N specifies the passed indicator. Optional. Specifies whether the repository that is to be set is accessible.


Details

l_rc

specifies the return codes for the method.

Note:   Be sure to check the return code for this method. Do not continue if the method fails.   [cautionend]

l_meta

specifies the passed metadata property list for the secondary repository that is to be set. You must pass the ID property in this list. See the following Usage notes.

repos_id

specifies the returned repository ID for the secondary metadata repository that was set. Use this ID as the reposid part of the metadata identifier in subsequent methods that access metadata in this repository.

already

specifies the passed indicator. Optional. Specifies whether the repository that is to be set is accessible.

0 -- (default) repository is not accessible. Perform the process to gain access to the repository.

1 -- repository is accessible.

A repository might already be accessed for several reasons. If you know that the repository is already accessed, this indicator can be set to 1 to indicate that fact. Note that you should use this parameter with caution because possible future changes to a metadata repository structure might cause incorrect results.

Note:   Mixed usage (both 0 and 1) of the already parameter during a single execution of an application is strongly discouraged. All calls to _SET_SECONDARY_REPOSITORY_ during a single execution should use a single value, either 0 or 1.   [cautionend]


Using _SET_SECONDARY_REPOSITORY_

Primary and secondary repositories are discussed in Metadata Repositories. To set a secondary repository, you must pass the ID property for this method, and you can pass the LIBRARY property.

ID

specifies the metadata identifier of the secondary repository. Normally, the information that is needed to access the secondary repository is stored as a piece of metadata within the primary repository. If the metadata that is stored is sufficient for your application to access the secondary repository, then this is all that is required.

The example shows how to use the ID property in the l_meta list to set a secondary metadata repository.

LIBRARY

specifies an optional property that allows the stored metadata information to be overridden with the information that is specified here. An example of this might be if the administrator's metadata libname definition does not gain you proper access to a secondary repository (for example, SAS/SHARE access versus access other than SAS/SHARE).

Example: Set a Secondary Repository shows how to use the _GET_METADATA_ method to return the list of possible secondary repositories. Specify the REPOSITORIES property in the l_meta list, and use the returned metadata identifier from the _SET_PRIMARY_REPOSITORY_ method.

Note:   The current interpreter for SAS/Warehouse Administrator allows only one secondary repository to be active at any given time. If you are attached to a secondary repository and you attach to another secondary repository, you will be detached from the first one before you are attached to the other.   [cautionend]


Example: Set a Secondary Repository

   /* 
    *  Insert code to access the primary repository. 
    * 
    *  Get the list of available secondary repositories 
    *  under this primary repository. 
    */
l_reps=makelist(); 
l_meta=setniteml(l_meta,l_reps,'REPOSITORIES'); 
call send(i_api,'_GET_METADATA_',l_rc,l_meta); 
if l_rc = 0 then do; 

   num_reps=listlen(l_reps); 
   if num_reps > 0 then do; 
         /* 
          * If there are any secondary repositories, select 
          * one to set as the active one. 
          */ 
      l_sec_rep=getiteml(l_reps,1); 
      call send(i_api,'_SET_SECONDARY_REPOSITORY_',
               l_rc, l_sec_rep,sec_repos_id); 
         /* 
          * If l_rc = 0 then sec_repos_id contains 
          * the 8 character repository id of this 
          * repository. 
          * This id is used as the first part of any 
          * identifiers used to access metadata in this 
          * secondary repository. 
          */ 
     if l_rc = 0 then do; 

/* continue processing */ 


See Also

_SET_PRIMARY_REPOSITORY_

Previous Page | Next Page | Top of Page