BookmarkSubscribeRSS Feed
_Dan_
Quartz | Level 8

Hello there,

 

I've written Base & Macro code to obtain from Metadata a list of LASR instances I'd like to start in anticipation of an outage this weekend. Whilst I don't doubt this will work, I do like to throw caution to the wind and program for all eventualities - such as the Macro failing half-way through, needing a restart, and then failing again because it tries to start a server that's already started.

 

So, a very high level view of the code is this:
- Obtain Metadata list of servers.

- Define variables like Port, Tag, LogDir

- ?????

- Start Server

- Check Server status

 

????? is the missing piece - this is where I'd like to check the server is active prior to trying to start it up. Is there a decent way of doing this, one that either tells me the server is alive, or, one that handles an ERROR: properly and doesn't kill the SAS code (sort of like On Error Goto Next in VBA).

 

i'd like to do this in SAS code to remove any issues that may come with the permissions and governance of the Unix file system.

 

 

Thanks in anticipation,

 

Dan

2 REPLIES 2
SimonDawson
SAS Employee


You might consider issuing a serverinfo action using the imstat procedure. If you get the servers status back you can assume its up.

http://support.sas.com/documentation/cdl/en/inmsref/70021/HTML/default/viewer.htm#n0kpeeuwv9vy29n1ic...

_Dan_
Quartz | Level 8

Thanks Simon, you're right of course, but it just forces an ERROR: when the server has been terminated and I was looking for a method that would maybe prompt a Boolean response, or would be handled without forcing an ERROR: into the log.

 

At this time, I'm just assigning a LIBNAME (that also returns an ERROR: if the server is down) and I then use an IFC statement to query the existence of the libref, which then allows me to conditionally set a macro variable as to the success or failure of the server startup.

 

I wonder, is there a standard macro variable like &syserr, &sysrc etc that'll tell me the result of the PROC LASR CREATE once it's completed? As I'm not in a position to 'break' the CREATE procedure, I wouldn't be able to test the sort of response codes I could expect should the procedure fail or complete properly.

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 829 views
  • 0 likes
  • 2 in conversation