Previous Page | Next Page

Metadata API Class

_DELETE_METADATA_



Deletes specified metadata from a repository
Category: Write Methods

Syntax
Parameters
Using _DELETE_METADATA
Example: Delete Column Definitions
See Also

Syntax

CALL SEND(i_api, '_DELETE_METADATA_', l_rc, l_meta);

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 object that is to be deleted. For the general format of this list, see Metadata Property List.


Using _DELETE_METADATA

The object whose ID is included in the l_meta list will be deleted. Where appropriate, the metadata API will enforce metadata integrity by deleting all other metadata that is associated with the object that is being deleted.

CAUTION:
The _DELETE_METADATA_ method is destructive. Its changes cannot be reversed. When you use this method in an application, verify the delete request before you issue the method call.   [cautionend]

Be sure to check the return code of a write method call. A nonzero return indicates that a failure has occurred while trying to write to the metadata. If a nonzero return code is returned, none of the changes that are indicated by this method call will be made.


Example: Delete Column Definitions

   /* 
    *  Delete all the current column 
    *  definitions for the passed id.  
    */   
                  
l_meta=makelist();           
                                
l_meta=insertc(l_meta,selected_id,-1,'ID'); 
                       
   /*                  
    *  Get all of the columns.
    */             
                               
l_meta=insertl(l_meta,0,-1,'COLUMNS');
                                   
call send(i_api,'_GET_METADATA_',l_rc,l_meta);
                                
   /*                              
    *  Continue if zero return code 
    *  (removed for brevity of example)  
    *  :    
    */    
      
     
l_cols=getniteml(l_meta,'COLUMNS'); 
                       
num_cols=listlen(l_cols);
                        
do i=1 to num_cols while (l_rc = 0);
                    


   l_col=getiteml(l_cols,i); 
                         
      /*                             
       *  Delete each column.  
       */                       
                                             
   call send(i_api,'_DELETE_METADATA_',l_rc,l_col); 
                               
   if l_rc ne 0 then do;  
                                            
      msg=getnitemc(l_rc,'MSG',1,1,'ERROR:
          _DELETE_METADATA_ FAILED');
      put msg;      
                        
      list_rc=dellist(l_rc); 
                     
      end; /* if */ 
                 
   end; /* do */
    
l_meta=dellist(l_meta,'Y');


See Also

_ADD_METADATA_, _UPDATE_METADATA_

Previous Page | Next Page | Top of Page