Upload
trannguyet
View
217
Download
0
Embed Size (px)
Citation preview
Copyright © 2002, SAS Institute Inc. All rights reserved.Copyright © 2002, SAS Institute Inc. All rights reserved.
SAS Integration Technologies –A Roadmap
Mark TorrEMEA Technology Strategy ManagerSAS
Copyright © 2002, SAS Institute Inc. All rights reserved.
2
Overview✔ Introduction to SAS Integration Technologies✔ Components of SAS Integration Technologies
✔ Integrated Object Model (IOM)✄ Publishing Framework (PUSH Technology)✔ Enterprise Directory Support✔ Application Messaging Support
Will be covered in the next
paper!
Copyright © 2002, SAS Institute Inc. All rights reserved.
3
Introduction to SAS Integration TechnologiesDelivers support for communicating with SAS from external applications and systems as well as support for distributing information in a proactive manner. It does all this through a comprehensive collection of industry standards and a frameworkfor proactive information delivery known as the SAS Publishing Framework.
Copyright © 2002, SAS Institute Inc. All rights reserved.
4
SAS Integration Technologies....Exposes the SAS Integrated Object Model (IOM)
Copyright © 2002, SAS Institute Inc. All rights reserved.
5
The SAS Integrated Object Model (IOM)# Allows SAS to work seamlessly with distributed
object standards such as COM, DCOM and CORBA.
# It does this by providing a set of standard, well-defined interfaces that are documented through an interface definition language (IDL).
# These interfaces can be exploited via various programming interfaces by applications developers
Copyright © 2002, SAS Institute Inc. All rights reserved.
6
The SAS Integrated Object Model (IOM)# All this without having to know anything about
how SAS works.# This capability provides extensive reusability and
deployment flexibility.# SAS IOM interfaces can be scripted from a
variety of programming environments,
# You will see this in action during this paper…
Copyright © 2002, SAS Institute Inc. All rights reserved.
7
COM DCOM CORBA IOM Bridge
Ways to access the SAS IOM# Via the following communication technologies
Open Standard
Open Standard
Open Standard
SAS Standard
Copyright © 2002, SAS Institute Inc. All rights reserved.
8
Providing the following language support# Enable you to access SAS from open clients via
various languages
COM DCOM
VBScript (ASP)Javascript (ASP)Visual BasicVBA (Visual Basic for Applications)
(Visual) C++DelphiJavaAnd more ......
Open Standard
Open Standard
Copyright © 2002, SAS Institute Inc. All rights reserved.
9
Providing the following language support
CC++Java SmalltalkAdaAnd more ......
CORBA
# Enable you to access SAS from open clients via various languages
Open Standard
Copyright © 2002, SAS Institute Inc. All rights reserved.
10
Providing the following language support# Enable applications to communicate
transparently accross various platforms where COM/DCOM or CORBA are not supported
IOM Bridge
SAS Standard
Copyright © 2002, SAS Institute Inc. All rights reserved.
11
Just what is IOM Bridge# A SAS Proprietary communication capability
founded on the use of TCP/IP# he IOM Bridge provides the ability to run and
access SAS servers transparently across a range of enterprise computing platforms.
# Ensures that organizations can exploit SAS across Windows, UNIX and OS/390 operating systems.
Copyright © 2002, SAS Institute Inc. All rights reserved.
12
Just what is IOM Bridge# Enables the optimal utilization of computing
resources, regardless of divergent operating system standards.
# Designed specifically with skills reuse in mind. # For example, you can develop a Visual Basic
application utilizing the DCOM protocol to communicate with a Windows-based server. By changing only the destination server name at run time, that application can communicate with a server executing on a UNIX or an OS/390 operating system.
Copyright © 2002, SAS Institute Inc. All rights reserved.
Lets go take a closer look at the SAS Integrated Object Model (IOM)
Copyright © 2002, SAS Institute Inc. All rights reserved.
14
SAS Integrated Object Model (IOM)DataService
FileService
Utilities
LanguageService
StoredProcessService
Libref
Fileref
HostSystem
FormatService
ResultPackageService
BinaryStream
TextStream
ResultPackage
HTMLEntry
DataSetEntry
FileEntry
SAS Workspace
ADO/OLE DBor JDBC
Copyright © 2002, SAS Institute Inc. All rights reserved.
15
SAS Integrated Object Model (IOM)# SAS Workspace:
# Start SAS sessions on a server or on a local machine.
Copyright © 2002, SAS Institute Inc. All rights reserved.
16
SAS Integrated Object Model (IOM)# DataService
# Creates or manipulates SAS Library references
Copyright © 2002, SAS Institute Inc. All rights reserved.
17
SAS Integrated Object Model (IOM)# FileService
# Manages and accesses SAS File references
Copyright © 2002, SAS Institute Inc. All rights reserved.
18
SAS Integrated Object Model (IOM)# Utilities
# Accesses and creates result packages, formats and host information.
Copyright © 2002, SAS Institute Inc. All rights reserved.
19
SAS Integrated Object Model (IOM)# LanguageService
# Submits SAS programs or used to call stored SAS processes
Copyright © 2002, SAS Institute Inc. All rights reserved.
20
SAS Integrated Object Model (IOM)DataService
FileService
Utilities
LanguageService
StoredProcessService
Libref
Fileref
HostSystem
FormatService
ResultPackageService
BinaryStream
TextStream
ResultPackage
HTMLEntry
DataSetEntry
FileEntry
SAS Workspace
ADO/OLE DBor JDBC
Copyright © 2002, SAS Institute Inc. All rights reserved.
21
Integration Example# Using VBA (Visual Basic for Applications) in
Microsoft WordSub AutoOpen()
Dim s As SAS.WorkspaceDim sl As LanguageServiceDim logline As StringDim outlines() As StringDim outcc() As LanguageServiceCarriageControlDim outlt() As LanguageServiceLineTypeDim flush As IntegerDim line As Variant
Set s = New SAS.WorkspaceSet sl = s.LanguageService
sl.Submit ("proc print data=sasuser.class; run;")
End Sub
flush = 1Do While Not flush = 0
sl.FlushListLines 200, outcc, outlt, outlines
For Each line In outlinesSelection.TypeText line + vbCrLfIf line = Empty Then flush = 0
NextLoop
s.CloseSet sl = NothingSet s = Nothing
' Move to top of documentSelection.HomeKey Unit:=wdStory
Copyright © 2002, SAS Institute Inc. All rights reserved.
22
VBA and COM
Copyright © 2002, SAS Institute Inc. All rights reserved.
23
Integration Example# Calling some ODS code from ASP (VBScript)
using COM<HTML><BODY><%
Dim wsm, ws, wsStoredProcessService, wsFref, wsBinaryStream, wsStreamHelper, VisibilityProcess
VisibilityProcess = 1Set wsm = Server.CreateObject("SASWorkspaceManager.WorkspaceManager")Set ws = wsm.Workspaces.CreateWorkspaceByServer("server", VisibilityProcess, nothing, "", "", "")set wsStoredProcessService = ws.LanguageService.StoredProcessServicewsStoredProcessService.Repository = "file:d:\sas\testit"wsStoredProcessService.Execute "simplehtmls", ""set wsFref = ws.FileService.UseFileref("b")set wsBinaryStream = wsFref.OpenBinaryStream(0)set wsStreamHelper = CreateObject("SASScripto.StreamHelper")response.binarywrite wsStreamHelper.ReadBinaryArray(wsBinaryStream, 0)wsBinaryStream.Closewsm.Workspaces.RemoveWorkspace wsws.Close
%></BODY></HTML>
*ProcessBody;
filename b temp;ods html body=b (url="body.htm");
proc print data=sasuser.class;run;
ods html close;
Copyright © 2002, SAS Institute Inc. All rights reserved.
24
ASP (VBScript) and COM
Copyright © 2002, SAS Institute Inc. All rights reserved.
25
Microsoft ADO and OLE DB standards# Building on the points of platform compliance and
enterprise transparency, the IOM architecture supports the Microsoft ADO and OLE DB standards.
Copyright © 2002, SAS Institute Inc. All rights reserved.
26
What is OLE DB?# OLE DB is a set of interfaces for data access.# A Microsoft specification that provides universal
data integration over an enterprise's network, from mainframe to desktops, regardless of the data type.
# OLE DB evolved from Microsoft's Open Database Connectivity (ODBC) data access interface.
Copyright © 2002, SAS Institute Inc. All rights reserved.
27
What is ADO?# ADO is an application level interface to OLE
DB and is also a Microsoft technology # Stands for ActiveX Data Objects # Is a Microsoft Active-X component # Is automatically installed with Microsoft IIS # Is a programming interface to access data in a
database # Can be accessed from within your Active Server
Pages
Copyright © 2002, SAS Institute Inc. All rights reserved.
28
What is it in SAS that allows us to use ADO?# IOM utilizes standard interface mechanisms
within the Microsoft COM environment to expose the object hierarchy. # IOM can also utilize interface mechanisms in the Java environment although
they are not covered in this presentation.
# This enables you to use the the ActiveX Data Objects (ADO) and OLE DB access protocols in the Windows COM environment.
Copyright © 2002, SAS Institute Inc. All rights reserved.
29
So what are your options?# SAS Local Data Provider
# Requires only BASE SAS# Access to SAS datasets in a COM environment
# SAS/SHARE Data Provider # Requires BASE SAS and SAS/SHARE# Access to SAS datasets via a SAS/SHARE server
# SAS IOM Data Provider. # Requires only BASE SAS and SAS Integration Technologies# Access to SAS datasets via a SAS Object Server
# I will make use of the local provider in this explantion
Copyright © 2002, SAS Institute Inc. All rights reserved.
30
Some conventions# The normal way to access a database from
inside an ASP page is to:➼ Create an ADO connection to a database ➼ Open the database connection ➼ Create an ADO recordset ➼ Open the recordset ➼ Extract the data you need from the recordset ➼ Close the recordset ➼ Close the connection
Copyright © 2002, SAS Institute Inc. All rights reserved.
31
In the SAS WorldCreate an ADO connection object# …. and setup its properties!
<% DIM obConnectionSet obConnection = Server.CreateObject("ADODB.Connection")%>
obConnection.Provider = "sas.LocalProvider.1"obConnection.Properties("Data Source") = "C:\Program Files\SAS Institute\SAS\V8\core\sashelp"
This line is setting a property on the obConnection object (the ADO Connection) that tells it data provider you are going to use with this connection. Here the value is set to be the SAS local data provider and version 1 of the driver (sas.LocalProvider.1).
This line is setting a property on the obConnection object (the ADO Connection) that tells it where the data that you will read can be found.
Copyright © 2002, SAS Institute Inc. All rights reserved.
32
In the SAS WorldOpen/Close the connection# The simple line of code opens the connection
using the properties you have set with previous code
# After this code you would put all your code to utilize the connection.
# Remember to close the connection and release any locked resources
obConnection.Open
obConnection.Close
Copyright © 2002, SAS Institute Inc. All rights reserved.
33
What is a RecordSet?# After an ADO Database Connection has been
created it is possible to create an ADO Recordset.
# ������������� ����������������� ������������������������ ����� ��
# ����� ���������������������������� �������������������������������
Copyright © 2002, SAS Institute Inc. All rights reserved.
34
How do you create a RecordSet?
<%
DIM obConnection, obRecordSetSet obConnection = Server.CreateObject("ADODB.Connection")
obConnection.Provider = "sas.LocalProvider.1"
obConnection.Properties("Data Source") = "C:\Program Files\SAS Institute\SAS\V8\core\sashelp"
obConnection.Open
Set obRecordset = Server.CreateObject("ADODB.Recordset")obConnection.Close
%>
Declare the variable that will hold the RecordSet object
Create the RecordSet object. This line will always be the same with the exception that, of course, the variable you assing the newly created object to might be named differently.
Copyright © 2002, SAS Institute Inc. All rights reserved.
35
How do you open a RecordSet?
<%
DIM obConnection, obRecordSet
Set obConnection = Server.CreateObject("ADODB.Connection")
obConnection.Provider = "sas.LocalProvider.1"
obConnection.Properties("Data Source") = "C:\Program Files\SAS Institute\SAS\V8\core\sashelp"
obConnection.Open
Set obRecordset = Server.CreateObject("ADODB.Recordset")
obRecordset.Open "CLASS", obConnection, adOpenForwardOnly, adLockReadOnly, adCmdTableDirectobConnection.Close
%>
Using the RecordSet object that was created by the previous line of code you make a call to the Open method. This method takes a number of parameters.
The first parameter is the name of the dataset you want to read (in the directory you specified as a property of the connection)The second is the connection obkect that you with to use when opening this RecordSet The next three parameters are explained on the next slide
Copyright © 2002, SAS Institute Inc. All rights reserved.
36
How do you open a RecordSet?
const adOpenForwardOnly = 0
obRecordset.Open "CLASS", obConnection, adOpenForwardOnly, adLockReadOnly, adCmdTableDirect
Specifies the type of cursor you want. Your choice affect s memory usage and speed. This is a numeric value normally assigned as a constant that relates to one of these:
adOpenUnspecified, value = -1 – Does not specify a type of cursor
adOpenForwardOnly, value = 0 – Default value and used when you will only iterate forwards through the record set once
adOpenKeyset, value = 1 – Not discussed in this presentation and not supported by the SAS provider
Not discussed here are adOpenDynamic with a value of 2 and asOpenStatic (not supported by the SAS provider) with a value of 3.
Copyright © 2002, SAS Institute Inc. All rights reserved.
37
How do you open a RecordSet?
const adOpenForwardOnly = 0
const adLockReadOnly = 1
obRecordset.Open "CLASS", obConnection, adOpenForwardOnly, adLockReadOnly, adCmdTableDirect
Specifies the type of locking on records you want within the record set. This is a numeric value normally assigned as a constantthat relates to one of these:
adLockUnspecified, value = -1 – Does not specify a lock
adLockReadOnly, value = 0 – Opens the recordset as read only – you cannot alter the data
adLockPessimistic, value = 1 – L������������� ����������� ������ ������ ������������������������ �����������
adLockOptimistic , value = 2 – L������������� ����������� ����� ��� ����������������������������
Copyright © 2002, SAS Institute Inc. All rights reserved.
38
How do you open a RecordSet?Const adOpenForwardOnly = 0
Const adLockReadOnly = 1
Const adCmdTableDirect = 512
obRecordset.Open "CLASS", obConnection, adOpenForwardOnly, adLockReadOnly, adCmdTableDirect
What sort of open command is this and what do you want to run to populate the RecordSet. In this case we want to grab the whole table.
The thing that makes adCmdTableDirect unique is that it causes the provider to open the table through a direct file access interface; it does not use SQL processing to get at the data. adCmdTablealso "grabs the whole" table but it does so by turning the first parameter into a "SELECT * FROM ..." statement. With the local provider, adCmdTabledoesn't work since there is no SQL provider support.
Copyright © 2002, SAS Institute Inc. All rights reserved.
39
Closing the RecordSet# Fairly easy to do.# You should close it and set it to nothing to clear
up memory when you are finished
# Having established a connection and created a RecordSet we now want to iterate around it to add HTML tags
obRecordset.Closeset obRecordSet = Nothing
Copyright © 2002, SAS Institute Inc. All rights reserved.
40
Some infoThe cursor starts off pointing at the first row in the record set.
The total grid is known as a RecordSet and refers to the whole information retrieved from the database or in the case of SAS the dataset.
A call to obRecordSet.Fields returns a collection that is a set of objects. Each object in the collection is essentially one column in that row. We can loop around the collection examining each object.
A call to object.name will return the name of the variable (i.e. SEX)
A call to object.value will return the value of the variable (i.e. M)
Copyright © 2002, SAS Institute Inc. All rights reserved.
41
<table border=1 cellpadding=3 cellspacing=3 align=center><tr>
<% For Each column In obRecordset.Fields %><td align=center><%= column.Name %></td>
<% Next %></tr>
<% Do While Not obRecordset.EOF %><tr>
<% For Each column In obRecordset.Fields %><td><%= column.Value %></td>
<% Next %></tr><%
obRecordset.MoveNextLoop
%></table>
Get access to the collection on the current cursor position that represents a row of the RecordSet and loop around the collection assigning, on every iteration, the current cell object to a variable with a name of column for later use.
Examine the current object for its name (in this case the SAS Variable Name)
Loop again and look at the next column. With this code we are writing the titles in the HTML table. Note that we have not moved the cursor at the end of this loop so our cursor is still pointing to the first row in the RecordSet!
Copyright © 2002, SAS Institute Inc. All rights reserved.
42
<table border=1 cellpadding=3 cellspacing=3 align=center><tr>
<% For Each column In obRecordset.Fields %><td align=center><%= column.Name %></td>
<% Next %></tr>
<% Do While Not obRecordset.EOF %><tr>
<% For Each column In obRecordset.Fields %><td><%= column.Value %></td>
<% Next %></tr><%
obRecordset.MoveNextLoop
%></table>
Start a loop and keep going until all records in the RecordSet have been read. A flag called EOF will be set to be TRUE when all records have been read
Loop through the RecordSet one record and extract the value of each cell in the record set on the current row where the cursor is.
Goto the next column if there is one.
Copyright © 2002, SAS Institute Inc. All rights reserved.
43
<table border=1 cellpadding=3 cellspacing=3 align=center><tr>
<% For Each column In obRecordset.Fields %><td align=center><%= column.Name %></td>
<% Next %></tr>
<% Do While Not obRecordset.EOF %><tr>
<% For Each column In obRecordset.Fields %><td><%= column.Value %></td>
<% Next %></tr><%
obRecordset.MoveNextLoop
%></table>
Move the cursor to point to the next record (row) in the RecordSet. If this is not possible because all rows have been read then the EOF flag will be set to TRUE and on the next loop we will escape from the iteration
Check the While condition again.
Copyright © 2002, SAS Institute Inc. All rights reserved.
44
The Full Code<%
Const adOpenForwardOnly = 0
Const adLockReadOnly = 1
Const adCmdTableDirect = 512
DIM obConnection
Set obConnection = Server.CreateObject("ADODB.Connection")
obConnection.Provider = "sas.LocalProvider.1"
obConnection.Properties("Data Source") = "C:\Program Files\SAS Institute\SAS\V8\core\sashelp"
obConnection.Open
Set obRecordset = Server.CreateObject("ADODB.Recordset")
obRecordset.Open "CLASS", obConnection, adOpenForwardOnly, adLockReadOnly, adCmdTableDirect
obRecordset.Close
set obRecordSet = Nothing
obConnection.Close
%>
<table border=1 cellpadding=3 cellspacing=3 align=center><tr>
<% For Each column In obRecordset.Fields %><td align=center><%= column.Name %></td>
<% Next %></tr>
<% Do While Not obRecordset.EOF %><tr>
<% For Each column In obRecordset.Fields %><td><%= column.Value %></td>
<% Next %></tr><%
obRecordset.MoveNextLoop
%></table>
Copyright © 2002, SAS Institute Inc. All rights reserved.
45
The Result!
We could, just as easily, have created an XML document or some other markup.
Copyright © 2002, SAS Institute Inc. All rights reserved.
46
Benefits of the SAS IOM# Reuse existing IT skills - therefore reduce the
cost of retraining# More easily integrate the capabilities of SAS into
existing enterprise architectures# Use almost any programming environment to
create clients that access the functionality of SAS# Extend the IOM by creating custom services
allowing reuse of existing code# Use all computing and data resources in your
enterprise
Copyright © 2002, SAS Institute Inc. All rights reserved.
47
Benefits of the SAS IOM# Creates an open set of services that can be used
by….# Internal SAS applications
• SAS® Information Delivery Portal• SAS Enterprise Guide™• Many more in the future...
# External applications
Copyright © 2002, SAS Institute Inc. All rights reserved.
Enterprise Directory Support
Copyright © 2002, SAS Institute Inc. All rights reserved.
49
Enterprise Directory Support – Why?# Today’s enterprise computing environments
support an extensive array of users and resources, frequently managed within the isolated administration domains of individual applications.
# Consequently, as users require more access to resources across multiple domains, administration becomes problematic.
Copyright © 2002, SAS Institute Inc. All rights reserved.
50
Enterprise Directory Support – Why?# Enterprise directory platforms alleviate this
problem by providing a common repository from which user, resource and security-policy information can be centrally managed
# The last few years have seen the establishment of LDAP as the client access standard to directory servers.
# The protocol’s acceptance is reflected through its support within a wide variety of enterprise directory products such as Microsoft’s Active Directory and iPlanet Directory Server.
Copyright © 2002, SAS Institute Inc. All rights reserved.
51
Enterprise Directory Support – Why?# For an enterprise directory strategy to be successful, all
applications must participate. # SAS Integration Technologies enables SAS applications, and
applications external to SAS, to realize the benefits of directories by providing an LDAP API that can be called from SAS.
LDAP
Open Standard
iPlanet directory server Microsoft active directory
Any directory that is LDAP enabled
Copyright © 2002, SAS Institute Inc. All rights reserved.
52
Directory Services Support (via LDAP)# SAS client API
# Data Step# SCL# Macro
# LDAP is supported in many other worlds including Java which has JNDI (Java Naming and Directory Interface)
Copyright © 2002, SAS Institute Inc. All rights reserved.
53
Using the LDAP API
%let host="localhost";%let port=389;%let base="o=mycompany.xyz.com";%let directorymangager_pw="adminpassword";
/* do not modify this */%let error=0;
Copyright © 2002, SAS Institute Inc. All rights reserved.
54
Using the LDAP API %macro ldap_open;
if _n_ = 1 then do;retain handle 0;retain rc 0;call ldaps_open(handle, &host,&port,&base, "cn=Directory Manager",&directorymangager_pw,rc);if rc ne 0 then do;
msg = sysmsg();put msg;call symput("error",symget("error")+1);
end;else do;
put "[LDAP]: LDAPS_OPEN call was successful.";end;
end;%mend;
Copyright © 2002, SAS Institute Inc. All rights reserved.
55
Using the LDAP API %macro ldap_close;
if last then do;call ldaps_close(handle,rc);if rc ne 0 then do;
msg = sysmsg();put msg;call symput("error",symget("error")+1);
end;else do;
put "[LDAP]: LDAPS_CLOSE call was successful.";end;
end;%mend;
Copyright © 2002, SAS Institute Inc. All rights reserved.
56
Using the LDAP API
data _null_;%ldap_open;set sashelp.class end=last;call ldaps_add(handle,"cn="!!trim(Name)!!",ou=People,o=mycompany.xyz.com",rc,"sn",1,trim(Name),
"uid",1,trim(Name),"objectclass",2,"person","inetorgperson","userpassword",1,trim(Name),"description",1,"Testentry");
%ldap_close;run;
Copyright © 2002, SAS Institute Inc. All rights reserved.
Application Messaging Support
Copyright © 2002, SAS Institute Inc. All rights reserved.
58
SAS Integration Technologies# Enables the use of message orientated
middleware
MQSeries MSMQ
IBM Standard
Microsoft Standard
Copyright © 2002, SAS Institute Inc. All rights reserved.
59
Messaging: What does it buy me?# “Connectionless” nature for providing services# Scalable and Asynchronous# Guaranteed store-and-forward delivery# Standards!
Copyright © 2002, SAS Institute Inc. All rights reserved.
60
Overview# Open Standards
# COM, DCOM, CORBA# LDAP
# Message Orientated Middleware# IBM MQSeries, MSMQ
# Platform Transparency (Maintaining MVA)# IOM Bridge
Copyright © 2002, SAS Institute Inc. All rights reserved.
61
Overview# Language Support (to talk to SAS)
#Java, C, C++, Visual C++, Ada, SmallTalk, VBScript, Visual Basic, Visual Basic for Applications, Delphi and more!
# Applications Support#Productivity Tools (Microsoft Word for example!)# IT Operational Systems (Through the use of
messaging)#Any that support open standards!
Copyright © 2002, SAS Institute Inc. All rights reserved.
62