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

Hi there,

We have structure like Folder--->Jobs------>Data . Out of this I can see data in folders but how to find the exact jobs on server. These data tables are registered by using Proc Metalib so I can view them  but how to find out if jobs are not registered.I need to list out the jobs. To be specific, is there any way to find out without creating the SPK ??? I hope that I am clear and making sense

1 ACCEPTED SOLUTION

Accepted Solutions
CameronL
Fluorite | Level 6

Look at proc metadata

%let xfile = %nrquote(<<Output XML FILE>>.xml);

filename myinput temp lrecl=256;

filename myoutput xfile lrecl=256;

options metapass="<<USERNAME>>"

        metaport=<<PORT>>

        metaprotocol=bridge

        metarepository="<<REPOSNAME>>"

        metaserver="<<METASERVERADDRESS>>"

        metauser="<<PASSWORD>>";

data _null_;

   file myinput;

   input;

   put _infile_ ' ';

   datalines;

<GetMetadataObjects>

<Reposid><<ID OF YOUR METADATA REPOSITORY>></Reposid>

<Type>Job</Type>

<Objects/>

<NS>SAS</NS>

<Flags>401</Flags>

<Options>

</Options>

</GetMetadataObjects>

;;

run;

proc metadata

   in=myinput   

   out=myoutput

   header=full;

run;    

Use the SAS XML Mapper to create a .map file and save it.  After that, issue a libname statement using the xml libname engine.  This creates a library which you can query like any other sas datasets.  I've attached a default map for you.

filename mymap = %nrquote(<<FILENAME and PATH of MAP FILE>>);

libname xfile xml xmlmap=mymap;

This will return all jobs.  If you need Deployed Jobs, replace the Type in the GetMetadataObjects with the type of "JFJob".  You can also use filters in GetMetadata to only show jobs with the ID's you mentioned.  Details are on support.sas.com. 

Cam

View solution in original post

4 REPLIES 4
CameronL
Fluorite | Level 6

Unless you deploy the job for scheduling the job is defined in the SAS metadata server and not in a physical drive.  That means the job structure is stored in tables as opposed to .sas files like you would in base/SAS or EG etc.  If you need to view job definitions you need to either query the metadata server using metadata functions or proc metadata.  If you have deployed your job for scheduling then the job defaults generally to your sas config directory under batch jobs.

forumsguy
Fluorite | Level 6

Thanks a lor CameronL .... One more question... can u help me out in printing job names in Enterprise guide ... See I have jobs with Ids as A35467U.12G,A35467U.169 and A35467U.144 .. how do I print the corresponding object name in Base SAS ... I know getattr function can be used here but how to is something I am really confused.. can u plz show some direction

CameronL
Fluorite | Level 6

Look at proc metadata

%let xfile = %nrquote(<<Output XML FILE>>.xml);

filename myinput temp lrecl=256;

filename myoutput xfile lrecl=256;

options metapass="<<USERNAME>>"

        metaport=<<PORT>>

        metaprotocol=bridge

        metarepository="<<REPOSNAME>>"

        metaserver="<<METASERVERADDRESS>>"

        metauser="<<PASSWORD>>";

data _null_;

   file myinput;

   input;

   put _infile_ ' ';

   datalines;

<GetMetadataObjects>

<Reposid><<ID OF YOUR METADATA REPOSITORY>></Reposid>

<Type>Job</Type>

<Objects/>

<NS>SAS</NS>

<Flags>401</Flags>

<Options>

</Options>

</GetMetadataObjects>

;;

run;

proc metadata

   in=myinput   

   out=myoutput

   header=full;

run;    

Use the SAS XML Mapper to create a .map file and save it.  After that, issue a libname statement using the xml libname engine.  This creates a library which you can query like any other sas datasets.  I've attached a default map for you.

filename mymap = %nrquote(<<FILENAME and PATH of MAP FILE>>);

libname xfile xml xmlmap=mymap;

This will return all jobs.  If you need Deployed Jobs, replace the Type in the GetMetadataObjects with the type of "JFJob".  You can also use filters in GetMetadata to only show jobs with the ID's you mentioned.  Details are on support.sas.com. 

Cam

forumsguy
Fluorite | Level 6

Thanks a lot... it solved the purpose...

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 4 replies
  • 3599 views
  • 1 like
  • 2 in conversation