Chapter Contents |
Previous |
Next |
SAS/SHARE User's Guide |
The following tasks to customize macros are explained:
See SAS/SHARE Macros for complete information about the syntax of the SAS/SHARE autocall macro library and how to use it.
Specifying the APPLSYS Macro Library |
!sasroot/saspgm/sassaml
Files in the APPLSYS macro library must have a .SAS extension. These files are referred to as members.
To use the default library table, you omit the APPLSYS= argument to the SHRMACS macro. For example,
%shrmacs(user);
%shrmacs(user, applsys=purchas);
It may be more convenient to allow different users or departments to maintain their own APPLSYS macro libraries. You can indicate that an alternate APPLSYS macro library be used instead of the default library by specifying the SASSAML= argument to the SHRMACS macro.
The value of this argument can be the host-specific physical name of the alternate library or the string _DEFINED_, which indicates that the fileref SASSAML has already been assigned to the alternate library. For example:
%shrmacs(user,applsys=purchas,sassaml=library-path);or
%shrmacs(user,applsys=_DEFINED_);
Typical host-specific examples of how to specify an alternate APPLSYS macro library follow:
%shrmacs(user,applsys,sassaml=/dept/mis/applsys);
Defining Server Aliases in the Server-Alias Table (SERVID) |
Server aliases can be helpful for
To define server aliases, create a member named SERVERID in the APPLSYS macro library. The member name must be SERVERID because the SHRMACS macro looks for that specific name.
Define a server alias in the SERVERID member using the following syntax:
%SERVID(alias,serverid); |
Server-Alias Table shows an example of a SERVERID member.
Server-Alias Table
/***************************************************/ /* */ /* NAME: SERVERID */ /* */ /* SERVER ALIAS TABLE ENTRIES */ /* */ /* This member defines aliases for server names. */ /* The entries in this member are loaded into */ /* the server alias table by the SHRMACS macro. */ /* This table is used by the SERVERID macro to */ /* translate an alias to an actual serverid. */ /* */ /* To add aliases to the table, add a SERVID */ /* call for each alias at the end of this */ /* member. Specify the alias and then the */ /* real serverid. */ /* */ /***************************************************/ %servid(shr7,shrserv7) %servid(share1,shrserv3) %servid(pubserv,shrserv7)
To add aliases to the table, use a SERVID call for each alias-serverid pair.
Associating SAS Libraries with Server Aliases (SERVLIB) |
%SHRMACS(user,APPLSYS=purch);you also create a member in the APPLSYS library of the same name in this example, PURCH.
In a selected member, specify the library and server name pairs by using the following syntax:
%SERVLIB(SAS-data-library, server-name); |
Library-Alias Table shows an example of a member named PURCH, which contains references to host-specific SAS library names.
Library-Alias Table
/**********************************************************************/ /* */ /* NAME: PURCH */ /* */ /* LIBRARY TABLE ENTRIES - SPECIFIC APPLICATION */ /* */ /* This member associates server names with libraries. The entries */ /* in this member are loaded into the library table if the */ /* SHRMACS macro is called by using the argument APPLSYS=APPLSAMP.*/ /* The entries can also be loaded by using a call to the LIBDEF */ /* macro if APPLSYS=APPLSAMP is specified. */ /* */ /* To add libraries to the definition table, add a SERVLIB call */ /* for each library at the end of this member. Specify the */ /* physical name for the library and the name of the server to be */ /* associated with the library. The name may be an alias or an */ /* actual serverid. */ /* */ /**********************************************************************/ %servlib(appljan c, testserv); # CMS %servlib(disk1$:[shrtest.appljan.lib1), testserv); # OpenVMS %servlib(d:\shrtest\appljan\lib1, testserv); # OS/2 %servlib(shrtest.appljan.lib1, testserv); # OS/390 %servlib(/shrtest/appljan/lib1, testserv); # UNIX %servlib(d:\shrtest\appljan\lib1, testserv); # Windows
To add aliases to the table, use a SERVLIB call for each library-server pair.
Additionally, create a member in the APPLSYS macro library named DEFAULTS. This member can be empty, but must be present to avoid error messages from the SHRMACS macro.
The DEFAULTS member is used when the APPLSYS= argument is omitted on a call to the SHRMACS and LIBDEF macros.
The syntax of the PURCH and the DEFAULTS members are identical.
Creating the Server Information Table and Adding Server Attributes (SERVINFO) |
You can use this table to store other attributes of the server or its users or administrators, such as server access passwords, PROC SERVER statement options, and the release of SAS software that the server runs under.
Use the SERVINFO macro to add an entry to the server information table. Use the following syntax:
%SERVINFO (node.server-id, netnode=fully-qualified-node-name, RMTVIEW=NO); |
A typical use of this macro is for the SERVERID macro to generate an alias for a node name that is not a valid SAS name. For example, when the two-level server name and the netnode are specified in the server information table as follows:
%servinfo (hp.shrserv,netnode=hp103.dom2.acme.com);server SHRSERV runs on HP103.DOM2.ACME.COM.
In resolving an alias for HP.SHRSERV, SERVERID generates
%let hp=hp103.dom2.acme.com;
Customizing a Server Information Table |
%macro servinfo(servid,version=,rmtview=, netnode=,sasrel=);
%GLOBAL isrvr&srvinum irmtv&srvinum inode&srvinum isrel&srvinum;
%LET isrel&srvinum = &sasrel;
%put &pline RMTVIEW %shrrpt(-,3) NETWORK NODE %shrrpt(-,20) RELEASE %shrrpt(-,3);
%put %shrrpt(-,78);
%do i=1 %to &srvinum; %let pline=%shrrpt(&blank,3) %shrfmt(&&isrvr&i,16); %let pline=&pline %shrfmt(&&irmtv&i,11) %shrfmt(&&inode&i,36); %let pline=&pline &&isrel&i; %put &pline; %end;
The first six steps illustrate how you would alter the server information table for display only.
%let i=%serviidx(&new_id); %if (&&isrel&i^=) %then %do; /* some use of &&isrel&i here */ %end;
%servinfo(rmthost.share1,netnode=.acme.com, rmtview=no,sasrel=6.12); %servinfo(rmthost.share2,netnode=smith.acme.com, rmtview=yes,sasrel=7);
The following code shows the server information table that is sent to the SAS log when you invoke the LISTSRVI macro.
%listsrvi; SERVER INFORMATION TABLE --- SERVERID --- RMTVIEW -- NETWORK NODE --- RELEASE RMTHOST.SHARE1 NO rmthost.acme.com 6.12 RMTHOST.SHARE2 YES smith.acme.com 7 ----------------------------------------------------
Generating a LIBNAME Statement (LIBDEF) |
%LIBDEF(libref,SAS-data-library-name) <,APPLSYS=app-sys-lib-tab>; |
Note: Do not enclose the SAS data library name
in quotation marks. Using quotes will cause the generation of the LIBNAME
statement to fail.
Note: Before you invoke
the LIBDEF macro, you must first invoke the SHRMACS macro.
The LIBDEF macro generates a LIBNAME statement by searching the library table for the library name. It then invokes the SERVERID macro to convert the server alias into a serverid.
Host-specific examples of how to use the LIBDEF macro follow:
%libdef(mylib/shrtest/appljan/lib1);
Each macro invocation defines the library to the libref MYLIB. You can define additional libraries without invoking the SHRMACS macro again.
If you want to use server aliases but you have not created the library- and server-name pairs in the APPLSYS macro library yet, you can use a LIBNAME statement and invoke the SERVERID macro in place of the SERVER= argument. See SAS/SHARE Macros for more information.
Using the APPLSYS= Argument in the SHRMACS and LIBDEF Macros |
You can specify the APPLSYS= argument in either the SHRMACS or the LIBDEF macro. Calling the SHRMACS and LIBDEF Macros with the APPLSYS= Argument illustrates application excerpts that show how to access libraries from three different applications systems (PURCH, MAINT, and FACIL) that use the APPLSYS= argument to the SHRMACS and LIBDEF macros, as appropriate.
Calling the SHRMACS and LIBDEF Macros with the APPLSYS= Argument
/* Most libraries will come from purchasing appl sys.*/ %shrmacs(user,nomsg,applsys=purch); /* Access purchase order library.*/ %libdef(polib,SAS-data-library1); . . . . /* Access vendor service library from maintenance appl sys.*/ %libdef(vndsvc,SAS-data-library2,applsys=maint); . . . . /* Access vendor account library from purchasing appl sys. */ /* */ */ /* (Note: It is not necessary to specify APPLSYS= for this */ /* application system because it was specified above.) */ /* */ %libdef(vndacct,SAS-data-library3); /* Access vendor contact library from maintenance appl sys.*/ /* */ /* (Note: It is not necessary to specify APPLSYS= for this */ /* application system because it was specified above.) */ /* */ %libdef(vndcon,SAS-data-library4); . . . . /* Access inventory library from facilities appl sys. */ %libdef(invlib,SAS-data-library5,applsys=facil); /* Access invoice library from purchasing appl sys. */ %libdef(invoice,SAS-data-library6);
Note: You supply a SAS-data-library using
the syntax convention that is appropriate for your host.
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.