Chapter Contents

Previous

Next
SAS/SHARE User's Guide

Setting Up the Application System (APPLSYS) Macro Library

The data that is used by the macros is stored in tables in another macro library that you maintain as you add and delete libraries, servers, and application systems. This library is called the APPLSYS (an acronym for application system) macro library.

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

The default name of the APPLSYS macro library is host-dependent. The default macro library names follow:

CMS
SASSAML MACLIB

OpenVMS
SAS$ROOT:[SASSAML]

OS/2
!SASROOT\SHARE\SASMACRO

OS/390
SAS.SASSAML

UNIX
!sasroot/saspgm/sassaml

Windows
!SASROOT\SHARE\SASMACRO

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);

To specify an alternate library-alias table, supply the APPLSYS= argument to the SHRMACS macro. For example:

%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:

OpenVMS
%shrmacs(user,applsys,sassaml=MIS$:[applsys]);

OS/2
%shrmacs(user,applsys,sassaml=c:\dept\mis\applsys);

UNIX
%shrmacs(user,applsys,sassaml=/dept/mis/applsys);

Windows
%shrmacs(user,applsys,sassaml=c:\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)

Create a member in the APPLSYS macro library for each application system that is specified by the APPLSYS= argument to the SHRMACS macro. Doing this defines library-server pairs that a specific application is likely to use. For example, if you specify an APPLSYS library named PURCH in the SHRMACS macro as follows,

%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);
where SAS-data-library is specific to the host, and server-name can be represented as a serverid or its alias.

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 create a server information table to store information about the servers at your site. You can use this information in a program or you can display it. By default, the table contains the following information:

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

This example shows how to customize your server information table to include the SAS/SHARE server's SAS software release level. The steps in the example accomplish the following objectives:

  1. Add new parameter SASREL= to the SERVINFO macro statement, as follows:
    %macro servinfo(servid,version=,rmtview=,
    netnode=,sasrel=);

  2. Add a new variable ISREL&SRVINUM to the %GLOBAL statement to account for the new parameter SASREL, as follows:
    %GLOBAL isrvr&srvinum irmtv&srvinum 
       inode&srvinum isrel&srvinum;

  3. Because the table is implemented as sets of macro variables, assign the value &SASREL to the macro variable ISREL&SRVINUM as follows:
    %LET isrel&srvinum = &sasrel;

  4. In the LISTSRVI macro, modify the line that prints the headers for the table as follows:
    %put &pline RMTVIEW %shrrpt(-,3) 
       NETWORK NODE %shrrpt(-,20) RELEASE %shrrpt(-,3);

  5. For aesthetics, you may want to change the %PUT statement in the LISTSRVI macro to extend the dashed line following the table so that it matches the length of the modified header line.
    %put %shrrpt(-,78);

  6. Change the loop that prints the table so that it looks like this:
    %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.

  7. If you wanted to be able to access and use the information in the table for a macro or a program, you would have to use the SERVIIDX macro, as shown in the following code fragment:
    %let i=%serviidx(&new_id);
    %if (&&isrel&i^=) %then
      %do;
       /* some use of &&isrel&i here */
      %end;

  8. After you have accounted for the new parameter and modified the format of the server information table, you will actually add entries to the table for all parameters as follows:
    %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)

If your SAS application accesses a server library, use the LIBDEF macro instead of a LIBNAME statement. Use the following syntax:

%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.   [cautionend]

Note:   Before you invoke the LIBDEF macro, you must first invoke the SHRMACS macro.  [cautionend]

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:

CMS
%libdef(mylib,appljan c);

OpenVMS
%libdef(mylib,disk1$:[shrtest.appljan.lib1);

OS/2
%libdef(mylib,d:\shrtest\appljan\lib1);

OS/390
%libdef(mylib,shrtest.appljan.lib1);

UNIX
%libdef(mylib/shrtest/appljan/lib1);

Windows
%libdef(mylib,d:\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.  [cautionend]


Chapter Contents

Previous

Next

Top of Page

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