SAS 9.1 Companion for Windows (2 Volumes)

Overview of Starting SAS as a Windows Service

Starting SAS as a Windows service enables you to start SAS automatically or manually, define recovery procedures if SAS fails, and enable users to log on and log off a PC without interrupting SAS. When SAS is defined to start manually, you can start SAS either from an application by using the net start command or by using the Windows Services dialog box.

The general process for configuring SAS as a Windows service is as follows :

  1. Create an initialization (.INI) file.

  2. Install the .INI file to register SAS as a Windows service.

  3. If SAS is configured to start automatically, restart your machine. If SAS is configured to start manually, you can start SAS either from an application or from the Services dialog box in Windows NT or the Services window in all other Windows operating environments. For more information, see Starting a SAS Service on page 239.

If you have multiple SAS configurations, you can create an initialization file for each configuration.

SAS provides the SAS Service Configuration Utility (SSCU) to configure the service and install the .INI file.

Starting the SAS Service Configuration Utility

To start the SSCU, do one of the following:

Creating an Initialization File

Overview of the Initialization File

Before you can start SAS as a Windows Service, you need to configure and install an initialization (.INI) file. The. INI file is a text file that

You create the initialization file either by using the SSCU graphical user interface (GUI) or by using a text editor. If you use the SSCU GUI, you specify only the required values and the SSCU creates the .INI file for you. If use a text editor to create the .INI file, you must specify the SAS service settings and their values. Table 9.4 on page 236 explains the settings that you specify to create a SAS service .INI file with a text editor.

Creating an Initialization File Using the SAS Service Configuration Utility

Use the SAS Service Configuration Utility (SSCU) that is shown in the following display to create the .INI file. After configuring the settings, click the Install/Save File tabbed page to save and install the .INI file.

Display 9.5: SAS Service Configuration Utility

To configure the INI file, select the following tabbed pages and modify the appropriate settings:

Install tabbed page

Remove tabbed page

Options tabbed page

Account tabbed page

Install/Save File tabbed page

Copyright tabbed page

Creating the Initialization (INI) File Using an ASCII Editor

To create a SAS Service INI file by using any text editor, create a new file in the editor and assign a valid value to each of the settings in the following table. Type only one setting per line:

Table 9.4: SAS Service INI File Settings and Default Values

Setting Name

Required

Explanation

Valid Values

Defaults

Related SSCU Field

ServiceName=

Yes

TheSAS Service name registered to Windows.

Can contain up to 32 characters (/ and \are not valid). Thenameis not case sensitive and it must be contained in quotation marks.

"SASService"

Service Name

Display Name=

Yes

The name of the service that is displayed to user-interface applications.

Can contain up to 256 characters, is not case sensitive, and must be contained in quotation marks.

"ASAS Service"

Display Name

Binary Path

Name=

Yes

Contains the directory path in which the SAS Service INI file is installed, followed by the SAS command to start the service.

The path name must be contained in both brackets and quotation marks.

[" SAS installation path \sas.exe -noterminal"]

ServicePath

StartType=

Yes

Specifies whether the SAS Service is to start manually or automatically.

SERVICE_AUTO_START SERVICE_ DEMAND_START SERVICE_DISABLED

SERVICE_ DEMAND_ START

Start Type

Dependencies=

No

Specifies Windows services that must be started before this service is started.

One or more Windows service names, separated by the pipe () character. Enclose dependences in quotation marks.

none

Dependencies

Description

No

A description of the service

The description can contain alphanumeric characters and must be enclosed in quotation marks.

none

Description

WorkDir=

No

The directory used by applications to store files created and used by the SAS Service.

The path to the working directory must be contained in quotation marks.

"c:\WINNT \Profiles\ username " or "c:\Documents and Settings\ username "

Working Path

ErrorControl=

Yes

Determines the error severity if the SAS Service fails to start.

SERVICE_ERROR_ IGNORE SERVICE_ERROR_ NORMAL SERVICE_ERROR_ SEVERE SERVICE_ERROR_ CRITICAL

SERVICE_ ERROR_ NORMAL

Error Control

Interactive=

Yes

Specifies whether the service allows a user to interact with the SAS desktop.

TRUE

FALSE

FALSE

Interactive Process

AccessChgCfg=

Yes

Modifies the SAS Service configuration.

TRUE

FALSE

TRUE

Change Configuration

Access Interrogate=

Yes

Requests that the SAS Service immediately update its current status.

TRUE

FALSE

TRUE

Interrogate

Access PauseCont=

Yes

Pauses and resumes the SAS Service.

TRUE

FALSE

TRUE

Pause/ Continue

AccessQryCfg=

Yes

Makes queries about the SAS Service configuration.

TRUE

FALSE

TRUE

Query Configuration

AccessQry Status=

Yes

QueriesWindowsNT about the status of the SAS Service.

TRUE

FALSE

TRUE

Query Status

AccessStart=

Yes

Starts the SAS Service.

TRUE

FALSE

TRUE

Start Service

AccessStop

Yes

Stops the SAS Service.

TRUE

FALSE

TRUE

Stop Service

AccessUser DefCtrl=

Yes

Specifies a user-defined control code.

TRUE

FALSE

TRUE

Define Control

ServiceStart Name=

No

The Windows user account with proper user rights to run the SAS Service.

LocalSystem or Windows accountname

LocalSystem

This Account

Password=

No

The Windows account password.

an encrypted password

none

Password

When you create an .INI file by using an ASCII editor and you want to specify ServiceStartName for a specific user, the Windows account name must be of the format domainname\username and you must include an encrypted password in the PASSWORD setting name. You can use the PWENCODE procedure to create an encrypted password. For example, the following PWENCODE procedure specifies mypw as the input password:

proc pwencode in='mypw'; run;

The SAS log displays the encrypted password [sas001}bXlwdw== . You then specify [sas001}bXlwdw== as the value for the Password= setting in your ASCII file. An encrypted password is necessary only if you specify Password= in an ASCII file. In comparison, when you create an .INI file by using the SSCU, you specify a text password. The SSCU encrypts the password for you.

For more information about the PWENCODE procedure, see Base SAS Procedures Guide .

Installing a SAS Service

When you have created the initialization file, you use the initialization file to install SAS as a service. A SAS service can be installed either from the SSCU, from the command prompt, or from within an application.

To install a SAS Service by using the SSCU:

  1. Select the Install/Save File tab.

  2. Select Install from file .

  3. From the Open dialog box, select an INI file.

  4. Click Open .

To install a SAS Service from the command prompt, ensure that both the SAS Service Configuration Utility directory and the directory that contains the INI file are accessible from your system path. From the command prompt type sscu.exe path / filename .ini . When you install a SAS Service from the command prompt, user messages are disabled.

When a SAS Service is installed from an application, the command to install the service is sscu.exe path / filename .ini . The following table lists the return codes that can be passed back to the calling application:

Table 9.5: Return Codes from Installing or Running a SAS Service

Numeric

Code

Error Code Description

SUCCESS

The service has successfully been installed.

5

ERROR_ACCESS_DENIED

Access to the Service Control Manager is denied .

6

ERROR_INVALID_HANDLE

Error loading the Service Control Manager.

25

ERROR_NOT_FULL_PATH_CREATED

The full path could not be created.

26

USER_CANCELLED_INSTALL

The user cancelled the installation.

30

SUCCESS_NO_REG_DIR

The service was installed but failed to register the working directory.

35

ERROR_BINPATH_NOTFOUND

The service file was not found, no installation

40

ERROR_USER_CANCEL_NOSRVC

The user cancelled the installation because an INI file was not found.

50

ERROR_MISSING_FILE_ARGUMENT

A required argument in the INI file is missing.

51

ERROR_INVLAID_FILE_ARGUMENT

An INI file argument contains an incorrect value.

55

ERROR_OPENFILE

The INI file could not be opened.

60

ERROR_ITEMTOOLARGE

A string value exceeds the maximum character limit.

65

ERROR_PASSED_DECRYPT_FAILED

The password could not be decrypted.

87

ERROR_INVALID_PARAMETER

A service parameter is incorrect.

123

ERROR_INVALID_NAME

The specified service name is not valid.

1057

ERROR_INVALID_SERVICE_ACCOUNT

The account name is incorrect or does not exist.

1060

ERROR_SERVICE_DOES_NOT_EXIST

The specified service does not exist as an installed service.

1065

ERROR_DATABASE_DOES_NOT_EXIST

The specified database doesnot exist.

1072

ERROR_SERVICE_MARKED_FOR_DELETE

The specified service has been marked for deletion.

1073

ERROR_SERVICE_EXISTS

A duplicate service name exists on the network.

1078

ERROR_DUPLICATE_SERVICE_NAME

A duplicate display name exists on the network.

Starting a SAS Service

A SAS Service can be started automatically or manually. If the SAS Service is configured to start automatically, the service starts when the system starts. If the SAS Service is configured to start manually, the service can be started either from an application by using the net start command or by using the Services dialog box.

To start a SAS Service using the Services dialog box:

Removing a SAS Service

A SAS Service can be removed as a Windows service from the SSCU or from the command prompt.

To remove a SAS Service by using the SSCU:

  1. Open the SSCU and click the Remove tab.

  2. Select the SAS Service from the Remove Existing Services box.

  3. Click Remove .

To remove a SAS Service from the command prompt, type sasservicemngr.exe / remove < servicename > .

Категории