Chapter Contents

Previous

Next
SAS/SHARE User's Guide

Why Use Macros for Server Library Access?

Programs that use SAS/SHARE software must include a LIBNAME statement to identify the SAS/SHARE server through which a library is to be accessed. Adding servers and changing serverids can require users and server administrators to obtain current serverid information each time they want to access a server. Thus, maintaining production or utility programs can be very difficult.

Moreover, although there is no permanent connection between a SAS library and a given server, there is frequently a logical one. Programmers, server administrators, and users may always want a library to be accessed through the same server, particularly because only one server can provide access to a library at a time. The same logical connection can also exist between a group of users and a server. It may be desirable or necessary for all the members of a department to use the same server, especially if they are sharing libraries.

To make the most of SAS/SHARE software without compromising performance, administrators often need a dynamic and flexible server environment. They need to be able to start and stop servers as the need arises, and to easily redistribute the load on the servers. They want to be able to switch libraries and users from one server to another quickly and easily. To balance the needs of both administrators and users, SAS/SHARE software includes macros to be defined through the autocall function of the SAS macro facility.

These SAS/SHARE macros enable the administrator to define aliases for a server and to associate an alias with a given library. Programs can then issue these macros to generate the requisite LIBNAME statements that access the library through the server that is associated with the alias. Thus, the administrator can add servers, change serverids, and switch libraries and users from one server to another in a manner that is totally transparent to the program or SAS user.

There are macros to do the following tasks:

The serverid that is associated with an alias can be changed during any appropriate server or application outage (for example, down time). You update only the file that contains the table of macro variables that maps aliases to serverids. Additionally, a library can be logically associated with a different server by updating the table that associates libraries with server aliases.

For example, a site might have four logical servers (that is, four different server aliases) but only one physical server by having all the aliases map to the same serverid. Whenever the load on that single server gets too heavy, the site can start an additional server and shift certain libraries and users to it by simply pointing one of the aliases to that new server.


The SAS/SHARE Macros

SAS/SHARE software includes three categories of autocall macros:


Utility Macros

The utility macros and their functions are:

SHRMACS
compiles all the other macros and builds the server-alias and library-alias tables.

SERVERID
takes a server alias and looks up the serverid in the server-alias table and generates serverid or SERVER=serverid, as appropriate.

SERVIIDX
returns the index of the entry in the server information table for the specified server.

LISTSRV
writes the server-alias table to the log.

LISTLIB
writes the library-alias table to the log.

LISTSRVI
lists the server information table to the log.


User Program Macro

The user program macro and its function is

LIBDEF
takes a libref and an optional physical library name and looks up the SAS library name in the library-alias table and generates a LIBNAME statement.


Server Administrator (Operator) Macros

The macros used in server administrator programs are:

STRTSRV
starts a server with the appropriate serverid by using the SERVERID macro to convert the alias. The macro takes a server alias and PROC SERVER statement options.

SHUTSRV
generates the PROC OPERATE statement and STOP SERVER command for the appropriate serverid by using the SERVERID macro to convert the alias. The macro takes a server alias and an optional password.

OPERATE
generates PROC OPERATE statements for the appropriate serverid by using the SERVERID macro to convert the alias. The macro takes a server alias and an optional password.

SETSRV
generates a SET SERVER serverid statement by using the SERVERID macro to convert the alias. The macro takes a server alias and an optional password.


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.