BookmarkSubscribeRSS Feed
Babloo
Rhodochrosite | Level 12

I want to track the SAS job name which was executed, job start time, job end time, job folder location and job status after the execution of every job in SAS DI 4.9. Is there any table which automatically pulls this details for every job? If yes, I can pull those information via SAS code which I can place in 'post code' section

 

Objective is to get these details from SAS and insert it into the SQL table.

9 REPLIES 9
JosvanderVelden
SAS Super FREQ
Have you seen the paper "Using SAS® Job Monitor to Analyze SAS® Data Integration
Studio Job Performance": https://www.sas.com/content/dam/SAS/support/en/sas-global-forum-proceedings/2019/3586-2019.pdf
Babloo
Rhodochrosite | Level 12
Could you please tell me how can I achieve the objective only via DI?
Because I do not have access to other softwares like Environment manager,
Management console....
Patrick
Opal | Level 21

@Babloo 

I've seen people implementing such stuff via a custom transformation which they just add at the start and beginning of a DIS job - or if you don't need an entry if a job fails then just at the end. I've seen other people doing it via macro calls just added as pre- and post-code to the DIS job.

Transformation Return Code Check generates SAS code which gives you a very good start to develop such custom code.

 

BUT: DIS jobs get scheduled and run in batch. Many schedulers maintain a repository where such execution information gets stored. I believe you only should go for a DIS only solution if the scheduler doesn't maintain the information you need. LSF for example got this information and you can query it and extract the info into a SAS table.

 

Because the scheduling process is the parent, your SAS job can terminate in any way and you still maintain all the execution information. For example if an abort statement gets executed somewhere in the middle of your job (i.e. by a lookup transformation) then the node at the end of the DIS job writing status information gets never executed - but the scheduler will have the information that the job terminated with return code n.

 

Babloo
Rhodochrosite | Level 12
I'm trying to implement the things in precode and postcode with the use of
macros. Again how and where can I store the values of macros without
creating datasets. Once I have this information in SAS, I have to feed the
values in SQL table.

Also could you please tell me where can I find the transformation return
code in DI job?
Patrick
Opal | Level 21

@Babloo 

Add DIS transformation Return Code Check to any DIS job, create a new action and select "Send Entry to a Dataset". The generated macro code under the code tab will give you a very good starting point to implement what you're after.

Capture.JPGCapture.JPG

 

 

Or if what comes out of the box is enough for you then you can also use the DIS job level status handling. You get there just by right clicking on the job canvas.

Capture.JPG

 

You can also select an action of custom - and custom could then be a SAS macro where you're doing whatever you need.

Capture.JPG

Babloo
Rhodochrosite | Level 12
I have to extract variable value from the DIS job folder and I would like
to know where the folder details are stored apart from the properties of
the job.

If it not stored any where apart from properties, how can I extract value
from that?
Patrick
Opal | Level 21

@Babloo 

A) Your question is not clear

B) You really need to start and look into and understand DIS generated code to get a better grasp what's available to you.

 

If you don't see what you need in generated code then "play  around" changing options and then revisit the generated code and check if that gives you the required information. 

 

You could of course always query SAS metadata for additional metadata information. Given that a deployed job (.sas file) doesn't need to be in sync with its originating metadata or that for moving a job (.sas file) the originating metadata doesn't necessarily need to be migrated as well, I wouldn't consider such metadata queries as good idea.

Babloo
Rhodochrosite | Level 12
Assume my jobs are located in
/var/data/life/myjob
/var/data/nonlife/myjob

Now I want to create one new variable called DOMAIN which should say which
domain DIS job belongs to. In my example life and nonlife is domain and so
the new variable DOMAIN should have those values.

My question is how to find values for new variable from the DIS job folder?
Patrick
Opal | Level 21

@Babloo 

And my answer is that you should ask a new question as a new question, that you should inspect the DIS generated code to determine if there is already a macro variable created that has this information in it. If not then you would need to query SAS Metadata for additional SAS Metadata information. DIS generates the metadata job ID into your code (&jobID) so you've got a very good starting point for doing such a metadata query (but as said: job metadata does not need to be in sync with the deployed .sas file so....).

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 9 replies
  • 2449 views
  • 0 likes
  • 3 in conversation