BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
NN
Quartz | Level 8 NN
Quartz | Level 8

Hi all,
In SAS management console we have the option to "Deploy SAS datastep program"
while deploying we choose the "Source File" location where the source sas code currently resides.

when we redeploy the job it picks up the updated code from the "Source File" location and deploys the job.

My question is , is there i way i can find out what was the Source File location of a deployed job ?

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
gwootton
SAS Super FREQ

This program could help:

 

/* Edit with connection information for the Metadata Server. */

options metaserver="meta.demo.sas.com"
		metaport=8561
		metauser="sasadm@saspw"
		metapass="password"
		metarepository=Foundation
		metaprotocol=bridge;

/* End Edit. */

data source;

	keep job_name source; /* Retain only the job name and it's source code full path. */

/* Initialize variables. */

	length type id job_uri job_name file_uri file_name dir_uri path $ 50; 
	call missing (of _character_);

	obj="omsobj:Job?@Id contains '.'"; /* Search criteria for Jobs. */

	job_count=metadata_resolve(obj,type,id); /* Count all jobs. Only run loop if jobs exist. */

	if job_count > 0 then do i=1 to job_count; /* Loop: For each job found, get attributes and associations. */
		rc=metadata_getnobj(obj,i,job_uri);
		rc=metadata_getattr(job_uri,"Name",job_name); /* Get job name. */
		rc=metadata_getnasn(job_uri,"SourceCode",1,file_uri); /* Get file Metadata object id.  */
		rc=metadata_getattr(file_uri,"Name",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 jobs found in Metadata."; /* If no jobs are found, write a message to the log. */
run;
--
Greg Wootton | Principal Systems Technical Support Engineer

View solution in original post

3 REPLIES 3
Sajid01
Meteorite | Level 14

Please have a look at this paper.
It will answer your questions and more https://www.aii-3.com/wp-content/uploads/2020/02/Schedule-SAS-Jobs-Using-Schedule-Manager.pdf  

gwootton
SAS Super FREQ

This program could help:

 

/* Edit with connection information for the Metadata Server. */

options metaserver="meta.demo.sas.com"
		metaport=8561
		metauser="sasadm@saspw"
		metapass="password"
		metarepository=Foundation
		metaprotocol=bridge;

/* End Edit. */

data source;

	keep job_name source; /* Retain only the job name and it's source code full path. */

/* Initialize variables. */

	length type id job_uri job_name file_uri file_name dir_uri path $ 50; 
	call missing (of _character_);

	obj="omsobj:Job?@Id contains '.'"; /* Search criteria for Jobs. */

	job_count=metadata_resolve(obj,type,id); /* Count all jobs. Only run loop if jobs exist. */

	if job_count > 0 then do i=1 to job_count; /* Loop: For each job found, get attributes and associations. */
		rc=metadata_getnobj(obj,i,job_uri);
		rc=metadata_getattr(job_uri,"Name",job_name); /* Get job name. */
		rc=metadata_getnasn(job_uri,"SourceCode",1,file_uri); /* Get file Metadata object id.  */
		rc=metadata_getattr(file_uri,"Name",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 jobs found in Metadata."; /* If no jobs are found, write a message to the log. */
run;
--
Greg Wootton | Principal Systems Technical Support Engineer
NN
Quartz | Level 8 NN
Quartz | Level 8
Thank you this definitely helps.

suga badge.PNGThe SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment. 

Join SUGA 

Get Started with SAS Information Catalog in SAS Viya

SAS technical trainer Erin Winters shows you how to explore assets, create new data discovery agents, schedule data discovery agents, and much more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 3 replies
  • 1470 views
  • 5 likes
  • 3 in conversation