Explicación : Paso DATA principal que consulta los metadatos para encontrar objetos 'StoredProcess' con un código fuente de tipo 'File'. Itera sobre los resultados para extraer los atributos de nombre y ruta de acceso, concatenando el directorio y el nombre del archivo.
¡Copiado!
data source;
keep stp_name source; /* Retain only the stored process name and it's source code full path. */
/* Initialize variables. */
length type id stp_uri stp_name file_uri file_name dir_uri path $ 50;
call missing (of _character_);
obj="omsobj:ClassifierMap?ClassifierMap[ @PublicType='StoredProcess'][SourceCode/File]"; /* Search critera for Stored Processes that have an external file source. */
stp_count=metadata_resolve(obj,type,id); /* Count all stored processes that meet our criteria. Only run loop if at least one exists. */
if stp_count > 0 then do i=1 to stp_count; /* Loop: For each stp found, get attributes and associations. */
rc=metadata_getnobj(obj,i,stp_uri);
rc=metadata_getattr(stp_uri,"Name",stp_name); /* Get stp name. */
rc=metadata_getnasn(stp_uri,"SourceCode",1,file_uri); /* Get file Metadata object id. */
rc=metadata_getattr(file_uri,"FileName",file_name); /* Get file name. */
rc=metadata_getnasn(file_uri,"Directories",1,dir_uri); /* Get directory Metadata object id. */
rc=metadata_getattr(dir_uri,"DirectoryName",path); /* Get path to directory. */
source=catx('/',path,file_name); /* combine directory path and file name to create full path to file.*/
output;
end; /* End loop. */
else put "WARN: No Stored Processes with external source code files found in Metadata."; /* If no jobs are found, write a message to the log. */
run;
1
DATASOURCE;
2
3
keep stp_name SOURCE; /* Retain only the stored process name and it's source code full path. */
4
5
/* Initialize variables. */
6
7
LENGTH type id stp_uri stp_name file_uri file_name dir_uri path $ 50;
8
call missing (of _character_);
9
10
obj="omsobj:ClassifierMap?ClassifierMap[ @PublicType='StoredProcess'][SourceCode/File]"; /* Search critera for Stored Processes that have an external file source. */
11
12
stp_count=metadata_resolve(obj,type,id); /* Count all stored processes that meet our criteria. Only run loop if at least one exists. */
13
14
IF stp_count > 0 THENDO i=1 to stp_count; /* Loop: For each stp found, get attributes and associations. */
15
rc=metadata_getnobj(obj,i,stp_uri);
16
rc=metadata_getattr(stp_uri,"Name",stp_name); /* Get stp name. */
17
rc=metadata_getnasn(stp_uri,"SourceCode",1,file_uri); /* Get file Metadata object id. */
18
rc=metadata_getattr(file_uri,"FileName",file_name); /* Get file name. */
19
rc=metadata_getnasn(file_uri,"Directories",1,dir_uri); /* Get directory Metadata object id. */
20
rc=metadata_getattr(dir_uri,"DirectoryName",path); /* Get path to directory. */
21
SOURCE=catx('/',path,file_name); /* combine directory path and file name to create full path to file.*/
22
OUTPUT;
23
END; /* End loop. */
24
ELSE put "WARN: No Stored Processes with external source code files found in Metadata."; /* If no jobs are found, write a message to the log. */
25
RUN;
Este material se proporciona "tal cual" por We Are Cas. No hay garantías, expresas o implícitas, en cuanto a la comerciabilidad o idoneidad para un propósito particular con respecto a los materiales o el código contenidos en este documento. We Are Cas no es responsable de los errores en este material tal como existe ahora o existirá, ni We Are Cas proporciona soporte técnico para el mismo.
SAS y todos los demás nombres de productos o servicios de SAS Institute Inc. son marcas registradas o marcas comerciales de SAS Institute Inc. en los EE. UU. y otros países. ® indica registro en los EE. UU. WeAreCAS es un sitio comunitario independiente y no está afiliado a SAS Institute Inc.
Este sitio utiliza cookies técnicas y analíticas para mejorar su experiencia.
Saber más.