Starting SAS as a Windows Service


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:

  • Select

    Start Programs your- SAS- System- folder SAS 9.1 Utilities

    SAS Service Configuration Utility

  • From the SSCU directory, type sasservicemngr.exe . The default SSCU directory is c:\Program Files\SAS\SAS 9.1\ core \sscu.

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

  • names the SAS service

  • specifies if the service is to start automatically or manually

  • defines paths to SAS and SAS working paths

  • specifies the level of access that an application has to the SAS service

  • names other Windows services that must be started before this service can be started

  • defines the actions that Windows is to complete if SAS fails to start as a service

  • specifies whether the SAS service is a system account or a local account

  • specify whether the user can interact with the SAS desktop.

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.

click to expand
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

  • Service Name

    • is the service name that is registered to Windows when the service is installed. The service name is also the name that is used when a net start or a net stop command is issued. This is a required field. The default is SASService .

  • Display Name

    • is the name of the service that is displayed to user-interface applications. This is a required field. The default is A SAS Service .

  • Start Type

    • specifies whether the SAS service is started manually, automatically, or is disabled. This is a required field. The default is Manual . Manual specifies that the service can be started by another process. Automatic specifies that the service is started automatically during system startup. Disabled specifies that the service cannot be started.

  • Service Path

    • contains both the directory path in which SAS is installed and also the SAS command that is used to start the service. This is a required field. For a new installation, the default path is the SAS installation path, followed by the command sas.exe -noterminal . If the SSCU has been installed previously, the default path is c:\Program Files\SAS Institute\SAS\V9\ followed by sas.exe -noterminal . The NOTERMINAL system option is required. To start a SAS program as a service, add the SYSIN system option followed by the program pathname and filename to the Service Path. To select a service path, click ... (ellipse button).

  • Working Path

    • is the working path that is used by applications that use the SAS Service to create directories, store files, and log information. This field is optional. The default is the user s profile directory, c:\WINNT\Profiles\ username in Windows NT or c:\Documents and Settings\ username in Windows 2000, Windows XP, or Windows Server 2003. To select a working path, click ... (ellipse button).

  • Dependencies

    • specifies one or more Windows services that must be started before this service is started. If a dependent service is installed and enabled, the service is started before this service is started. If a service is installed but disabled, this service will not be started.

      To specify dependencies, type one or more service names separated by the pipe ( )character. For example, NetDDENetDDEdsdm.

  • Description

    • Type a description of the service. The description appears in the Windows Services window.

Remove tabbed page

  • Remove Existing Service

    • specifies the name of the installed SAS service that you want to remove.

Options tabbed page

  • Error Control

    • determines the error severity if the SAS Service fails to start. Select one of the following error controls:

      Table 9.3

      Error Control

      Description

      Ignore

      The error is logged. Startup operations continue.

      Normal

      The error is logged and a message is displayed. Startup operations continue.

      Severe

      The error is logged and startup operations continue by using the last successfully installed INI file.

      Critical

      An attempt to log the error is made. If the startup operation is using the last known successful INI file, startup operations fail. If the startup operation is not using the last known successful INI file, it will attempt to restart the service by using the last successful INI file.

  • Access

    • is the level of access that an application has to the SAS Service. When you select an access level, such as Read, Write, or Execute, certain access type settings are set to TRUE in the INI file. To further configure all access types settings, click Custom . For a description of access type settings, see Table 9.4 on page 236. The access levels are

      • Read

        • enables an application to set the Interrogate , Query Configuration and Query Status access type settings. Selecting this access level sets the AccessInterrogate=, AccessQryCfg=, and AccessQryStatus= settings in the .INI file to TRUE .

      • Write

        • enables an application to set the Change Configuration access type. Selecting this access level sets the AccessChgCfg= setting in the .INI file to TRUE .

      • Execute

        • enables an application to set the Interrogate , Pause/Continue , Start Service , Stop Service , and Define Control access types. Selecting this access level sets the AccessInterrogate=, AccessPauseCont=, AccessStart=, AccessStop, and AccessUserDefCtrl= settings in the .INI file to TRUE .

Account tabbed page

  • System Account

    • specifies that the service is shared for all users that log on to the this machine. To enable the service to interact with the user from the desktop, select Allow this Service to interact with the Desktop . When you select System Account , the ServiceStartName= setting in the INI file is set to LocalSystem .

  • This Account

    • specifies that the service is for a specific user only. When you select This Account , type the account name in the box. Then type the password in the Password and Confirm Password boxes.

Install/Save File tabbed page

  • Install from file

    • Click the Install from file button to specify an initialization (INI) file to install.

  • Save settings to file

    • Click the Save settings to file button to save the settings that you have specified in the SSCU Configuration Utility GUI to a file.

  • Show file contents

    • Select the Show file contents box if you want to display the initialization file that you want to install or save in the File Content s box.

Copyright tabbed page

  • display the copyright information for the SAS Services Configuration utility.

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:

  • Under Windows NT, select

    Start Settings Control Panel Services

    • Under all other Windows operating environments, select

    Start Settings Control Panel Administrative Tools Services

  • From the Services list box, select the SAS service.

  • Click Start .

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 > .




SAS 9.1 Companion for Windows
SAS 9.1 Companion for Windows (2 Volumes)
ISBN: 1590472004
EAN: 2147483647
Year: 2004
Pages: 187

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net