Hi, I'm assuming you just want to scan a metadata folder to see whether or not it contains stored processes? The following example is more generic but creates a single table which lists all stored processes found in metadata (across all folders). You can adjust the code or simply filter for the folder you are after. As you mentioned the final list of reports is dependent on the permissions of the given user (if you are planning to run this as part of a Stored Process you don't need to have the meta* options):
options metaserver="localhost" metaport=8561 metauser="myuser" metapass="mypass" metarepository="Foundation";
data reports; length label $200 path $500 tmp $500; length uri $256 asnuri $256; nobj=1; n=1;
keep label path; do while(nobj >= 0); nobj=metadata_getnobj("omsobj:ClassifierMap?@Id contains '.' and @PublicType eq 'StoredProcess'",n,uri); rc=metadata_getattr(uri,"Name",label); rc=metadata_getnasn(uri,"Trees",1,asnuri); arc=metadata_getattr(asnuri,"Name",path);
/* walk through all the trees on this ClassifierMap object. */ rc = 1; do while(rc>0); rc=metadata_getnasn(asnuri,"ParentTree",1,asnuri); arc=metadata_getattr(asnuri,"Name",tmp); if (rc>0) then path = trim(tmp) || "/" || trim(path); end;
/* building the stored process full qualified path*/ path = "/" || trim(path) || "/" || trim(label) || "(StoredProcess)"; n=n+1; output; end; run;
... View more