Contents SAS/IntrNet 8.2: Application Dispatcher Previous Next

ALLOCATE Statement


Defines a file or library that the Application Server assigns


Syntax

ALLOCATE LIBRARY libref <engine> 'SAS-data-library' <options>;
ALLOCATE FILE fileref <device-type> 'directory-or-PDS-path' <host-options>;

The syntax of this statement is identical to that of the global LIBNAME and FILENAME statements.


Arguments

LIBRARY
associates a SAS libref (shortcut name) with a SAS data library. SAS librefs that are defined in the ALLOCATE LIBRARY statement can be listed in a DATALIBS, PROGLIBS, or ADMINLIBS statement.

SAS librefs that are listed in PROGLIBS or ADMINLIBS statements are assumed to contain catalogs that contain SAS programs that can be executed by the Application Server. The SAS programs can be SOURCE, MACRO or SCL catalog entries.

SAS librefs that are listed in a DATALIBS statement are available to all programs that are run by the Application Server.

FILE
associates a SAS fileref with an external file or directory. SAS filerefs that are defined in the ALLOCATE FILE statement can be listed in a DATALIBS, PROGLIBS, or ADMINLIBS statement.

The pathname for a SAS fileref that is used in a PROGLIBS or ADMINLIBS statement specifies a directory or partitioned data set (PDS). A directory is assumed to contain SAS source code in individual .sas flat files. A PDS is assumed to contain SAS source code in individual members.

SAS filerefs that are listed in a DATALIBS statement are available to all programs that are run by the Application Server.

Note: SAS librefs and filerefs that are defined outside PROC APPSRV by FILENAME or LIBNAME statements are not accessible by Application Server programs and cannot be listed in a DATALIBS, PROGLIBS, or ADMINLIBS statement.


Nesting Library Names in Concatenated Libraries

Concatenated Data Libraries

All data libraries that are nested in a concatenated library must be listed in DATALIBS.

One-level nested data libraries work regardless of the order of the libraries in the DATALIBS statement. For example,

   PROC APPSRV;
      ALLOC LIBRARY ONE '/path/one';
      ALLOC LIBRARY TWO ('/path/two' ONE);
      DATALIBS ONE TWO;

works whether the order of the libraries is coded as DATALIBS ONE TWO or DATALIBS TWO ONE.

Multilevel nested libraries work only if the order in the DATALIBS statement is correct. The following code does not work because library THREE is assigned before library TWO:

   PROC APPSRV;
      ALLOC LIBRARY ONE '/path/one';
      ALLOC LIBRARY TWO ('/path/two' ONE);
      ALLOC LIBRARY THREE ('/path/three' TWO);
      DATALIBS THREE TWO ONE;

Instead, use the following code:

   DATALIBS ONE TWO THREE;  /* or DATALIBS TWO ONE THREE; */

ALLOC statements are order dependent. PROC APPSRV performs an automatic check on library and file assignments during its startup phase. The code

   PROC APPSRV;
      ALLOC LIBRARY TWO ('/path/two' ONE);
      ALLOC LIBRARY ONE '/path/one';

fails because library ONE is not defined when the library TWO assignment is tested. This happens regardless of how the libraries are listed in the DATALIBS, PROGLIBS, or ADMINLIBS statements. Remember that the syntax is identical to that of a LIBNAME statement in SAS open code.

Every library that is used must be defined as a data library. The following code does not work because library ONE is not defined to be a data library:

   PROC APPSRV;  
      ALLOC LIBRARY ONE '/path/one';
      ALLOC LIBRARY TWO ('/path/two' ONE);
      DATALIBS TWO;

Concatenated Program Libraries

Nested program libraries generally do not work as expected. For example, the following code does not work when you attempt to run a program in library TWO. This is because library ONE is not assigned in the request executive when you attempt to assign library TWO.

   PROC APPSRV;
      ALLOC LIBRARY ONE '/path/one';
      ALLOC LIBRARY TWO ('/path/two' ONE);
      PROGLIBS TWO ONE;

You must change library ONE to a DATALIB by using the following code:

   PROC APPSRV;
      ALLOC LIBRARY ONE '/path/one';
      ALLOC LIBRARY TWO ('/path/two' ONE);
      DATALIBS ONE;
      PROGLIBS TWO;

The same problem can occur when you use ADMINLIBS. This can cause the most confusion because it is not always obvious what can be causing the problem.


Contents SAS/IntrNet 8.2: Application Dispatcher Previous Next