DI Studio Job: Status Handling/Send Email - how can I include HOSTNAME?

Accepted Solution Solved
Reply
Contributor
Posts: 63
Accepted Solution

DI Studio Job: Status Handling/Send Email - how can I include HOSTNAME?

First, let me start by saying that I am new to the SAS world.  So, it is possible that I am overlooking the obvious. :-)

 

Essentially, I have a DI Studio job that includes 2 controls:  User Written; Return Code Check.  Everything is working as expected.  On the Return Code Check, I am checking the status of my job, and sending emails on "Error" and "Successful".  I have 2 environments: DEV; PROD.  My jobs are setup and running in both environments.  Thus, when I get the emails, it is hard to determine which environment the email is from.  So, I would like to include the HOSTNAME in the email (I could use Outlook rules to key on this and do things for Errors).  Obviously, I can hardcode the host into the email, which is exactly what I am current doing.  My email for "Error" currently looks something like this:

 

     SASPROD -> Error: &etls_jobName (&jobID); TRANS_RD = &trans_rc

 

This becomes a problem when I promote a new (or updated) job from DEV to PROD, as I always have to remember to modify the Status Handling on each job...updating the HOSTNAME.  I have attempted to use &HOSTNAME, but that throws an error.  I would like to automatically include the HOSTNAME, server name, or something, that will automatically indicate which environment the message is from.

 

Any ideas?

 

Thanks for your time and help,

Ricky


Accepted Solutions
Solution
‎05-10-2017 08:43 AM
Esteemed Advisor
Posts: 6,685

Re: DI Studio Job: Status Handling/Send Email - how can I include HOSTNAME?

You could try automatic macro variable &syshostname.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers

View solution in original post


All Replies
Solution
‎05-10-2017 08:43 AM
Esteemed Advisor
Posts: 6,685

Re: DI Studio Job: Status Handling/Send Email - how can I include HOSTNAME?

You could try automatic macro variable &syshostname.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Contributor
Posts: 63

Re: DI Studio Job: Status Handling/Send Email - how can I include HOSTNAME?

@KurtBremser,

 

THANK YOU!!!  That is exactly what I was looking for.  I tried searching for everything and could not find this.  So, is there a list of these automatic macro variables that you can point me to?  Also, in User Written code, is there a preference as to whether you use these automatic macros variables v.s. global environment variables?

 

Again, thanks for your help,

Ricky

Esteemed Advisor
Posts: 6,685

Re: DI Studio Job: Status Handling/Send Email - how can I include HOSTNAME?

When you issue

%put _all_;

you get a listing of all currently defined macro variables; this is handy when you're looking for something.

Automatic macro variables are more or less platform-independent, while using %sysget() to utilize OS environment variables might give you additional information that SAS doesn't/can't provide.

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Contributor
Posts: 63

Re: DI Studio Job: Status Handling/Send Email - how can I include HOSTNAME?

@KurtBremser,

 

This is great stuff!  Thanks for your help.  Much appreciated.

 

Thanks,

Ricky

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 4 replies
  • 117 views
  • 3 likes
  • 2 in conversation