DISCONNECT= LIBNAME Statement Option

Controls how user proxy resources are assigned for a server user.

Valid in: SPD Server LIBNAME Statement
Default: NO

Syntax

DISCONNECT=YES | NO

Required Arguments

YES

closes network connections between the SAS client and the server when server librefs are cleared.

NO

closes network connections between the SAS client and the server only when the SAS session ends. This is the default setting.

Details

Each server user in a SAS session requires a server user proxy process to handle client requests. By default, this proxy is opened when the user assigns the first LIBNAME statement in the SAS session. It remains open until the SAS session ends. Closing the network connection ends all server user proxy processes for that session.
The advantage of this behavior is that the processor overhead required to create a server user proxy is required only when a user issues the first LIBNAME statement of the session. The disadvantage is that the server user proxy does not terminate until the user's SAS session ends. For example, if a user does not log off at the end of the day and leaves a server session running overnight, the user proxy remains in force, occupying system resources that might be used by other jobs.
The DISCONNECT= LIBNAME statement option is provided to control how user proxy resources are created and terminated for a server user. When DISCONNECT=YES is specified in the LIBNAME statement, the network connections between the SAS client and the server user proxy are closed when the user's last server libref in the SAS session is cleared. The clearing process closes the network connection and the server user proxy but not the SAS session. If the user issues a subsequent server libref in that SAS session, a new server user proxy is started up.
The advantage of using DISCONNECT=YES is that user resources are freed as soon as the user's last libref is cleared. The disadvantage of using DISCONNECT=YES is that the user needs to issue a subsequent LIBNAME statement in that session. Each LIBNAME assignment will launch a new server user proxy.
The DISCONNECT=YES LIBNAME statement option must be used with the LIBNAME CLEAR statement to be effective.
The DISCONNECT= state of the user proxy is determined by the first LIBNAME statement a user issues in the SAS session.

Example

The following output shows the result of multiple LIBNAME assignments under the default setting of DISCONNECT=NO. Libref Spud is assigned using user proxy process 8292, and then libref Spud is cleared. Then libref Cake is assigned, still using user proxy process 8292. The user proxy process is not terminated when libref Spud is cleared, and no new user proxy process is required to assign libref Cake.
libname spud sasspds 'potatoes' 
   server=husky.5400 
   user='bob' 
   passwd='bob123';

NOTE: Libref SPUD was successfully assigned as follows: 
      Engine:        SASSPDS 
      Physical Name: :8292/spds/test/potatoes/
libname spud clear;
libname cake sasspds 'carrots' 
   server=husky.6100 
   user='bob' 
   passwd='bob123';

NOTE: Libref CAKE was successfully assigned as follows: 
      Engine:        SASSPDS 
      Physical Name: :8292/spds/test/carrots/
If user Bob assigns another libref that specifies DISCONNECT=YES without first clearing the previous librefs, the new libref (Fruit) will reuse the active proxy process 8240. In this case, both the Cake and Fruit librefs must be cleared before the user proxy process can terminate.
libname fruit sasspds 'apples' 
   server=husky.6100 
   user='bob' 
   passwd='bob123'
DISCONNECT=YES;

NOTE: Libref FRUIT was successfully assigned as follows: 
      Engine:        SASSPDS 
      Physical Name: :8240/spds/test/apples/
Last updated: February 8, 2017