![]() | ![]() | ![]() | ![]() |
ASP Sample Library is a Microsoft Active Server Pages application written in VBScript. It demonstrates how to administer and use workspace pooling. This sample gives you the ability to create a WorkspacePool, use the WorkspacePool to access SAS through an IOM server and perform various reporting and data access tasks, and then shutdown the pool when it is no longer needed.
An updated version of this sample that utilitizes ASP.NET and the Microsoft .NET Framework is also available.
This sample consists of Active Server Pages that:
This sample demonstrates how to:
In this sample, we are not providing a detailed code explanation page like you normally find in samples here at SAS. Instead, we are providing sample code with more comments mixed in describing the code. You will need to download the sample package to get access to both the code and the code explanation.
This document will give you a basic overview of each page in this sample. In the case where there is a logical flow from one page to another, the subsequent pages will be listed under the initial page.
This ASP allows you to enter all the parameters necessary to create a WorkspacePool. If you use all the default values you will create a WorkspacePool that uses Local COM and runs on your local machine. You can experiment with the values and see which type of pool gives you the best performance for your application.
MakePool.asp: This page is called by PoolParams.asp, and uses the values entered in the form to create the WorkspacePool. After the WorkspacePool is created, the values in the ServerDef and LoginDef are displayed so you can verify what parameters were used to create the pool. The list of WorkspacePools are also displayed so you can view the details for a specific WorkspacePool.
This page displays the list of WorkspacePools that have been created in ASP Sample Library. It also displays the "Available Count" and "Total Count" for each WorkspacePool, which can be helpful in monitoring the performance of your WorkspacePool.
This page displays the details for the WorkspacePool selected in either MakePool.asp or Pool.asp. The details consist of the DNS name of each workspace in the pool, the userid the process is running as, the userid of the current client, the process ID of the workspace, and the OS where the workspace is running. This information is retrieved from the workspace using the HostSystem interface.
This page provides an interface to execute the other ASPs in this sample using a specific workspace pool. It populates a drop-down list with the available WorkspacePools to make it easy to choose between different pools that are available to your application.
This sequence of pages use ADO and DataService to display all the available libraries, data sets, and the contents of that data set. You can also add a new entry to the data set if you have write permission.
- DisplayLibraries.asp: displays a table containing all the available libraries on the IOM server. The list of libraries are retrieved using the ListLibrefs method of DataService, with the help of the Scripto library.
- DisplayMembers.asp: displays a table containing all the data sets in the library that was clicked. The list of data sets is retrieved from the SASHELP.VMEMBER table using ADO. SASHELP.VMEMBER is a table maintained by SAS that contains information about the currently assigned libraries.
- DisplayTable.asp (screen shot): displays a table containing all the data in the data set that was clicked. This page uses ADO to read the data in the data set, and will attempt to read the entire data set until EOF. If you are attempting to view a very large data set, your request may time out.
- DisplayForm.asp: builds a form which can be used to add a new record to the data set. This ASP will create an input form based on the columns in the data set, which it retrieves using ADO.
- PostRecord.asp: attempts to add the new record to the data set, based on the input from DisplayForm.asp. Only one informat is used by default, the date9. format for the d column in the STOCKS library. If you want to update any other data sets that require an informat, you will need to add it to the "SAS Informats" ADO command property.
This page provides a front end to several SAS stored processes: corrStocks.sas, getStockData.sas, and graphStockHistory.sas. You will not be able to use all the forms on this page until you download some stock data. Enter a stock ticker and click Download Data and if all works properly you will create a new data set containing the history for that stock. If you want to verify that the data set creation was successful, you can click on Show Complete SAS Log to view the log and verify there weren't any errors. The data contains basic stock information like open, close, high, low, and volume for each day that the stock market is trading. The data is updated daily so there is no need to update your data set more than once a day.
After you have downloaded some stock data, you can either update that data, run PROC CORR on the data, or generate an ActiveX chart which will display a line graph of the closing price for the stock. The list of stock tickers available is automatically populated using ADO and DataService.
- ManageStockData.asp: starting point to run the various stored processes against the STOCKS library.
- GetStockData.asp: calls stored process getStockData.sas, passing in the stock ticker. LanguageService is used to display the SAS log as a result of running the stored process.
- UpdateStockData.asp: calls stored process getStockData.sas for each stock ticker that is selected. This is the exact same code as GetStockData.asp, except for the loop that calls getStockData.sas for each ticker.
- DisplayStockHistory.asp (screen shot): passes the start date, end date, and stock ticker to the stored process graphStockHistory.sas, which builds a line chart of the closing price for the stock. This sample uses FileService to stream back the ODS html file and write it to the Response ASP object.
- DisplayProcCorr.asp: passes in a string of tickers to the stored process corrStocks.sas, which runs PROC CORR and builds ODS output. Then the ODS html file is streamed back using FileService and written to the Response.
This ASP allows you to select the parameters to pass into a stored process, buildActiveXPieChart.sas. This stored process will build an ActiveX pie chart. First you select which library to use. When you select a library, the page refreshes and displays the data sets available in that library. You then choose which data set within the library you would like to use. The page will refresh with the columns that are in that data set so that you can set all the parameters for building the pie chart.
Some sample input to build a pie chart:
Library: SASHELP Table: PRDSALE Chart this column: PRODUCT Sum by: ACTUAL Group by: PRODTYPE When you click "Build ActiveX Pie Chart" the values you selected will be passed to DisplayActiveXChart.asp (screen shot), which will call the stored process, passing in the parameters that were selected in BuildActiveXChart.asp. Then FileService is used to stream back the ODS html document containing the ActiveX chart.
This page displays the results of calling the stored process buildActiveXPieChart.sas. The only parameter passed in is the temporary fileref used to store the ODS html file. The pie chart is built using the default values for the macro variables. This is a simpler version of BuildActiveXChart.asp
This page simply displays SAS Log output for running PROC MEANS against SASHELP.CLASS. It demonstrates using LanguageService to submit SAS code and get results instead of using a stored process.
![]()
Frequently Asked Questions
Client Tier
- How do I get the ActiveX Graph Control?
It will be automatically downloaded from http://www2.sas.com/codebase/cgr/v82/sasgraph.exe. If this were a real production application, you would want to mirror a copy of the ActiveX control installation application on your local Web server, and use this as the codebase for your sas stored processes. This would minimize download times for users on your local network.
- Does this sample work with Netscape browsers?
All of the functionality in the ASP Sample Library is HTML and Javascript and should work fine in Netscape, except for the pages that display the ActiveX Graph Control.
- How can graphs be displayed in Netscape?
You have a couple alternatives. Instead of the ActiveX Graph Control you could use the SAS/GRAPH Applet for Java. The Graph Applet runs as a Java applet in either Netscape or Internet Explorer. You would need to modify buildActiveXPieChart.sas and graphStockHistory.sas to use the Java device. For more information, visit the Data Visualization Community.
Another option is to use the GIF device. This will produce a GIF image of the graph which you will have to stream back to your Web server and cache locally.
- Why do I see the error "Error message: SetFieldValue: Rowset used optimistic locking and the value of a column has changed since it was last read. (%1 : %2)" when I try to add a record on page PostRecord.asp?
This is caused by a change in the IOM ADO Provider for Version 9 and later. If you have installed a version of SAS newer than 8.2, PostRecord.asp will not work. We are working on a fix and will post an updated sample package when it is available.
Web Server Tier
For help configuring IIS and working with Active Server Pages, these resources are helpful:
MSDN: Active Server Pages
Microsoft Windows 2000 Server Documentation
- Why am I getting the error "Non-NULL controlling IUnknown was specified, and either the requested interface was not IUnknown, or the provider does not support COM aggregation" when my ASP uses the IOM Data Provider?
This error is typically caused by not intalling the latest version of the Windows Client Development Component. You can get the latest version from our Web site
- Why am I getting the error "Execute Init: ERROR: Transaction open failed. ... ERROR: Physical file does not exist, c:\WINNT\system32\XLANG" when I try to run an ASP?
This error is caused by not configuring your IIS application properly. This application needs to be created in the IIS administration tool. On Windows 2000 this tool is called Internet Services Manager and is in the Adminstrative Tools folder. See step 8 under Install the Sample on the Downloads page of this sample.
SAS IOM Server Tier
For more information about the SAS Integrated Object Model (IOM) and Integration Technologies, visit the Integration Technologies Software Site.
- How do I set up an IOM Bridge Server so I can access SAS using the IOM Bridge for COM?
See Setting up an IOM Bridge Server in the SAS Integration Technologies Library.
- Why am I getting "access denied" or "server execution failed" errors when I try to access my workspace pool?
There are special configuration steps necessary when you are attempting to access an IOM server using COM or DCOM. This page, Configuring COM/DCOM for Active Server Page Access, describes the different scenarios.
If you are still having problems after following these instructions, you should verify that there are no file access permission problems for the account that is accessing your IOM server. Specifically, you should verify that the account logging onto the IOM server has permission to run SAS and can read and write to the paths indicated for the "-WORK" and "-SASUSER" entries in sasv8.cfg. If these paths are not set to a specific folder, it also helps to set these explicitly.
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
These sample files and code examples are provided by SAS Institute Inc. "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and fitness for a particular purpose. Recipients acknowledge and agree that SAS Institute shall not be liable for any damages whatsoever arising out of their use of this material. In addition, SAS Institute will provide no support for the materials contained herein.
This document explains:
To run this sample, you must have the following software installed on your computer:
The latest Integration Technologies client component for Windows. You can download this software from our Web site. Select SAS Integration Technologies Client (for Windows) from the list of components.
To view the ActiveX Graphs in your Web browser, it is recommended you use Microsoft Internet Explorer 5 or later. Netscape browsers will not work.
Windows 2000 or Windows XP with Internet Information Services (IIS) 5. These are the environments where this sample has been developed and tested. This sample will also work on Windows NT4 with IIS 4 or Personal Web Server.
You will also need access to a SAS IOM server to use this sample. With this sample, you can access all the different types of IOM servers: IOM Bridge, DCOM, or local COM. If you will be accessing a DCOM or COM server you should read Configuring COM/DCOM for Active Server Page Access for information about the security issues involved with accessing a COM or DCOM server from an ASP.
For full functionality, you will need to verify that you have SAS/GRAPH installed on the IOM server. All other functionality in this sample is provided by SAS Integration Technologies and base SAS.
To install this sample you should have a working knowledge of Windows 2000 or XP administration, as well as IIS. It will also help if you have experience with HTML, VBScript, Active Server Pages, SAS Integrated Object Model, and ADO.
To install this sample:
Download the sample package to your computer and use the WinZip utility to extract the files to a directory on your computer.
To simplify deployment of this sample, you should unzip this file into
c:\Inetpub\wwwroot\, the default
location for your IIS Web folders.
The package contains one folder, AspSampleLibrary.
If you didn't unzip the package into the default location above, move the folder AspSampleLibrary into
your wwwroot directory for IIS. A typical location
is c:\Inetpub\wwwroot\AspSampleLibrary
In your AspSampleLibrary folder, you will find the folder AspSampleFiles.
This folder needs to be copied to the local file system of all IOM servers that you will be accessing. If you are
going to access an IOM server that is on the same machine as your Web server, you should leave AspSampleFiles
in the default location c:\Inetpub\wwwroot\AspSampleLibrary\AspSampleFiles. If your IOM server is on Unix or Linux,
you can put AspSampleFiles in your home user directory, /home/myuserid/AspSampleFiles/.
After you copy the AspSampleFiles folder to your IOM server, make sure that the Data subdirectory under AspSampleFiles has full read and write permissions for all user accounts that will be logging onto the IOM server. SAS data sets will be created in the Data directory. It should be safe to give all users full control of this folder to simplify the security settings.
Now that you know the location of your AspSampleFiles directory, you can update global.asa to reflect this default location. The value we are changing is the location of the stored process source repository.
AspSampleLibrary folder, open up global.asa in a text editor.Session("SASRepository") = "file:c:\Inetpub\wwwroot\ AspSampleLibrary\AspSampleFiles\Repository"Repository subdirectory on your IOM server. If your IOM server is on
Unix, and you put the AspSampleFiles folder
in your Unix home directory, then your new line would look something like: Session("SASRepository") = "file:/home/myuserid/AspSampleFiles/Repository"You also need to update init.sas, a SAS stored process in the AspSampleFiles/Repository
folder. Init.sas is called each time a workspace needs to get access to the STOCKS library. Change the libname statement
to point to your AspSampleFiles/Data folder on your IOM server.
If your IOM server is on Unix, and you put
the AspSampleFiles folder in your Unix home directory, then the new line will look something like:
libname stocks '/home/myuserid/AspSampleFiles/Data';
The SAS stored process getStockData.sas is also in the AspSampleFiles/Repository folder. This stored process goes out and downloads data from the internet. If you will be using this functionality, and you access the internet through a proxy server, you will need to update the proxy server information. If you don't use a proxy server, you should remove the proxy server option.
Locate the string
proxy="http://my.proxy.server:80";
and update it appropriately for your site.
Open up Internet Services Manager, the tool used to configure IIS.
Right click on your AspSampleLibrary folder, and then select Properties.
Under Application Settings click Create. This will identify AspSampleLibrary as an IIS application, and will execute the code in global.asa for new session initialization and application shutdown.
The default permissions of Read, Log visits, and Index this resource should be fine.
For Application Protection, it is recommended that you select High (Isolated) application protection. This will create a COM+ Application for AspSampleLibrary which you will be able to shutdown and restart independent of IIS. This prevents crashes of this sample from hanging up your entire IIS server. It is also necessary if you will be accessing a DCOM IOM server.
If you have other requirements for this application, such as user authentication, feel free to set those as well. This application will work fine with Anonymous, Basic Authentication, and Integrated Windows Authentication. Some additional configuration of your COM or DCOM server will be necessary depending on which authentication settings you choose. See Configuring COM/DCOM for Active Server Page Access for more information.
To run this sample, start Internet Explorer and go the URL where you installed AspSampleLibrary. A typical default URL is
http://localhost/AspSampleLibrary.
You should see a Web page similar to this one. From the default page, you can follow the links to create a new workspace pool, view the current workspace pools, or run one of the sample asp scripts that access SAS using a workspace pool.
This sample takes advantage of workspace pooling, and provides an interface to administer workspace pooling
through the web. You should understand what all of the parameters mean and do before you start playing
around with the sample. The documentation for the WorkspaceManager is available in saswman.chm, which is located in the
Shared Files\Integration Technologies subdirectory of your SAS installation directory. This file provides information about all of the objects and parameters that are associated with workspace pooling.
Using Workspace Pooling
has some more detailed information about workspace pooling and the different types of workspace pooling. This sample
uses Integration Technologies Pooling, not COM+ Pooling.
If you take all the defaults on PoolParams.asp to create a pool, you will create a WorkspacePool using your local COM IOM server. This is the easiest configuration, but will not give you the best performance since the IOM server and Web server will be competing for system resources.
You should play around with the WorkspacePool parameters and see what effect they have on the pool. If you are planning to deploy an application that uses workspace pooling but you aren't sure what settings to use, this is an easy way to test different settings.
After you have created a workspace pool, you will want to use it and see if its working. UsePool.asp provides a form that will be populated with all the available WorkspacePools as well as all the Active Server Pages we are providing with this sample. Choose which ASP you want to execute and which pool you want to use, and click Execute. You should verify that the value for your Repository is correct for your selected WorkspacePool.
For more information about the Active Server Pages in this application, check out the Details tab.
| Type: | Sample |
| Topic: | Third Party ==> Output ==> HTML Third Party ==> Programming ==> COM (Component Object Model) Third Party ==> Programming ==> ASP (Active Server Pages) Third Party |
| Date Modified: | 2008-02-07 07:44:18 |
| Date Created: | 2005-05-04 16:00:33 |
| Product Family | Product | Host | SAS Release | |
| Starting | Ending | |||
| SAS System | SAS Integration Technologies | Microsoft Windows 95/98 | 8.2 TS2M0 | |
| Microsoft Windows 2000 Advanced Server | 8.2 TS2M0 | |||
| Microsoft Windows 2000 Datacenter Server | 8.2 TS2M0 | |||
| Microsoft Windows 2000 Server | 8.2 TS2M0 | |||
| Microsoft Windows 2000 Professional | 8.2 TS2M0 | |||
| Microsoft Windows Server 2003 Standard Edition | 8.2 TS2M0 | |||
| Microsoft Windows XP Professional | 8.2 TS2M0 | |||
| Microsoft Windows Server 2003 Enterprise Edition | 8.2 TS2M0 | |||
| Windows Millennium Edition (Me) | 8.2 TS2M0 | |||
| Microsoft Windows NT Workstation | 8.2 TS2M0 | |||
| Microsoft Windows Server 2003 Datacenter Edition | 8.2 TS2M0 | |||




