Previous Page | Next Page

Metadata API Class

Introduction to Metadata API Methods

Methods that are specific to the metadata API class are described here.


Conventions

All lists and items in those lists that are passed to the API must have the UPDATE list attribute. This applies to both the read and write metadata methods.

Whenever an output list is returned, a list will be created for you if one is not passed. If one is passed, then the output information will be appended to the end of the existing list.


Error Codes

Metadata API methods return error codes in the l_rc parameter. If a method returns a nonzero l_rc, then the method failed, and l_rc is an error list identifier. It is your responsibility as the application programmer to delete this list after interrogating its contents (using PUTLIST, for example). The l_rc error list can contain the following named items:

RC

represents the numeric return code value.

MSG

specifies an optional error message that indicates the type of failure that occurred. The returned string can be a system message or a string that is generated by the API or API interpreters.


Metadata Property List

To read or write a metadata object, you must pass a list of properties for that object to the appropriate metadata API method. Typically, the metadata property list that you pass to a method includes an ID--the unique identifier for a particular metadata object. The list might also include the NAME and DESC properties.

The ID, NAME, and DESC properties are common to all metadata types. In this manual, these properties are often referred to as the general identifying information for a metadata object. For a description of the ID, NAME, and DESC properties, see Identifying Metadata.

A metadata property list is not limited to the ID, NAME, and DESC properties. If you are interested in other properties for a given metadata type, you can often pass those properties as named sublists. The following code sample shows how to use the _GET_METADATA_ method to return the LIBRARY, COLUMNS, and TABLE NAME properties for a detail table:

  id='A000000E.WHDETAIL.A000002X';
  l_meta=clearlist(l_meta,'Y');        
  l_meta=insertc(l_meta,id,-1,'ID'); 
                                                                                                        
     /*
      * Retrieve library, column, and table name
      * properties only.
      */

  l_lib=makelist();
  l_meta=insertl(l_meta,l_lib,-1,'LIBRARY');
  l_cols=makelist();
  l_meta=insertl(l_meta,l_cols,-1,'COLUMNS');
  l_meta=insertc(l_meta,' ',-1,'TABLE NAME');
  call send(i_api,'_GET_METADATA_',l_rc,l_meta); 

       /* returns list: */ 
L_META(
   ID='A000000E.WHDETAIL.A000002X' 
   LIBRARY=(
      ID='A0000001.WHLIBRY.A000000U' 
      NAME='Warehouse Data Library' 
      DESC='' 
   )[5] 
   COLUMNS=(
      (   ID='A000000E.WHCOLDTL.A0000032' 
          NAME='PRODNUM' 
          DESC='product number' 
       )[9] 
      (   ID='A000000E.WHCOLDTL.A0000034' 
          NAME='PRODNAME' 
          DESC='product name' 
       )[11] 
      (   ID='A000000E.WHCOLDTL.A0000036' 
          NAME='PRODID' 
          DESC='product id/abbreviation' 
       )[13] 
      (   ID='A000000E.WHCOLTIM.A00000FU' 
          NAME='_LOADTM' 
          DESC='DateTime Stamp of when row 
                was loaded' 
       )[15] 
   )[7] 
   TABLE NAME='PRODUCT' 
)[3]  

Not all properties are valid for a given method. To understand which properties for a given type are valid with a given method, see the documentation for each type.

Previous Page | Next Page | Top of Page