Hi,
I think you can use the below set of codes to find all Metadata Jobs as well as STPs list. Yeah, if you want any specific metadata folder jobs or STP then have to pass the Type and Attribute variable according to that.
For Jobs:
data work.JOBlist(drop=_: label="SAS JOB List" rename=(name=Job_Name)) ;
length id $17 _uri name description _modified _created location _location $256;
length created modified 8;
format created modified datetime.;
label id="Metadata ID"
name="JOB Name"
description="Description"
location="Folder Location"
created="Created"
modified="Last Modified";
_nobj=1;
_n=1;
call missing(id, _uri, name, description, _modified, _created, _location);
do while(_n le _nobj);
_nobj=metadata_getnobj("omsobj:Job?@Id contains '.'",_n,_uri);
_rc=metadata_getattr(_uri,"Id",id);
_rc=metadata_getattr(_uri,"Name",name);
_rc=metadata_getattr(_uri,"Desc",description);
_rc=metadata_getattr(_uri,"MetadataCreated",_created);
_rc=metadata_getattr(_uri,"MetadataUpdated",_modified);
created=input(_created,anydtdtm.);
modified=input(_modified,anydtdtm.);
* Get folder object the current JOB is in *;
_rc=metadata_getnasn(_uri,"Trees",1,_uri);
* Get folder name the current JOB is in *;
_rc=metadata_getattr(_uri,"Name",location);
_tree=1;
* Loop up the folder hierarchy *;
do while (_tree>0);
* Get the parent folder object *;
_tree=metadata_getnasn(_uri,"ParentTree",1,_uri);
if _tree > 0 then do;
* If there was a parent folder, get the name *;
_rc=metadata_getattr(_uri,"Name",_location);
* Construct the path *;
location=catx('/',_location,location);
end;
end; * Folder Hierachy *;
location = '/'||location;
output;
_n=_n+1;
end;
run;
For STPs:
data work.stplist(drop=_: label="SAS Stored Process List");
length id $17 _uri name description _modified _created location _location $256;
length created modified 8;
format created modified datetime.;
label id="Metadata ID"
name="Stored Process Name"
description="Description"
location="Folder Location"
created="Created"
modified="Last Modified";
_nobj=1;
_n=1;
call missing(id, _uri, name, description, _modified, _created, _location);
do while(_n le _nobj);
_nobj=metadata_getnobj("omsobj:ClassifierMap?@PublicType='StoredProcess'",_n,_uri);
_rc=metadata_getattr(_uri,"Id",id);
_rc=metadata_getattr(_uri,"Name",name);
_rc=metadata_getattr(_uri,"Desc",description);
_rc=metadata_getattr(_uri,"MetadataCreated",_created);
_rc=metadata_getattr(_uri,"MetadataUpdated",_modified);
created=input(_created,anydtdtm.);
modified=input(_modified,anydtdtm.);
* Get folder object the current STP is in *;
_rc=metadata_getnasn(_uri,"Trees",1,_uri);
* Get folder name the current STP is in *;
_rc=metadata_getattr(_uri,"Name",location);
_tree=1;
* Loop up the folder hierarchy *;
do while (_tree>0);
* Get the parent folder object *;
_tree=metadata_getnasn(_uri,"ParentTree",1,_uri);
if _tree > 0 then do;
* If there was a parent folder, get the name *;
_rc=metadata_getattr(_uri,"Name",_location);
* Construct the path *;
location=catx('/',_location,location);
end;
end; * Folder Hierachy *;
location = '/'||location;
output;
_n=_n+1;
end;
run;
Thanks.
... View more