WEB-BASED OLTP SYSTEM USING SAS - sasCommunity
WEB-BASED OLTP SYSTEM USING SAS - sasCommunity
WEB-BASED OLTP SYSTEM USING SAS - sasCommunity
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>WEB</strong>-<strong>BASED</strong> <strong>WEB</strong> <strong>BASED</strong> <strong>OLTP</strong> <strong>SYSTEM</strong><br />
<strong>USING</strong> <strong>SAS</strong><br />
Haidong Tang (Don)<br />
Shanghai Baosight Information Technology Co. Ltd.<br />
May, 2001<br />
Shanghai Baosight Information Technology Corporation Ltd.
AGENDA<br />
Introduction to Shanghai Baosight Corp.<br />
Why Web-based <strong>OLTP</strong> system<br />
Web-based <strong>OLTP</strong> system using <strong>SAS</strong><br />
A Web-based <strong>OLTP</strong> system using <strong>SAS</strong><br />
Sample <strong>SAS</strong> program<br />
Conclusions<br />
Shanghai Baosight Information Technology Corporation Ltd.
Introduction to<br />
Shanghai Baosight Corp.<br />
Shanghai Baosight Information Technology Corporation Ltd.
Shanghai Baosight Information<br />
Technology Corp. Ltd.<br />
Established in April 2000<br />
– Shanghai Baosteel Computer Co.<br />
– Shanghai Baosteel Software Co.<br />
– Shanghai Baoni Computer Co.<br />
Located in Pudong Zhangjiang Hi-Tech<br />
Park, Shanghai<br />
800 members (39 PhD ,136 MSc)<br />
Shanghai Baosight Information Technology Corporation Ltd.
Shanghai Baosight Information<br />
Technology Corp. Ltd. (cont.)<br />
Close relationship with Shanghai Baosteel<br />
Group Corporation<br />
Shanghai Baosight Information Technology Corporation Ltd.
Shanghai Baosight Information<br />
Technology Corp. Ltd. (cont.)<br />
Partnership with lots of famous companies<br />
Shanghai Baosight Information Technology Corporation Ltd.
Shanghai Baosight Information<br />
Technology Corp. (cont.)<br />
Experienced in ERP, Production Control<br />
System, Network, System integration, ebusiness,<br />
data analysis, etc.<br />
Successful cases in the areas of Banking,<br />
Metallurgy, Communication, Power,<br />
Trading, Finance, …<br />
http://www.baosight.com<br />
Shanghai Baosight Information Technology Corporation Ltd.
Data Strategies Dept.<br />
Shanghai Baosight Co.<br />
Majoring in statistical analysis, enterprise<br />
data warehousing, data mining, quality<br />
controlling, on-site consulting, system<br />
integration, and etc.<br />
More than 5 years on <strong>SAS</strong><br />
Successful cases in Shanghai Baosteel<br />
Group Corporation, especially in data<br />
warehousing<br />
Shanghai Baosight Information Technology Corporation Ltd.
system?<br />
Why Web-based Web based <strong>OLTP</strong> system<br />
Shanghai Baosight Information Technology Corporation Ltd.
What is <strong>OLTP</strong><br />
<strong>OLTP</strong> is the automation of high-volume,<br />
repetitive business processes<br />
Four types operation – query, insertion,<br />
modification and deletion<br />
Examples:<br />
Airline Seat Booking, ATM Withdrawal,<br />
MIS, etc.<br />
Shanghai Baosight Information Technology Corporation Ltd.
Characters of traditional <strong>OLTP</strong><br />
Private network<br />
Centralized hosts, or C/S<br />
Little downtime<br />
High security<br />
Quick response<br />
Shanghai Baosight Information Technology Corporation Ltd.
Drawbacks of traditional <strong>OLTP</strong><br />
Version control<br />
System management<br />
Application extension<br />
others<br />
Shanghai Baosight Information Technology Corporation Ltd.
What is Web-based Web based <strong>OLTP</strong><br />
Implementing <strong>OLTP</strong> functions on Web<br />
– Query<br />
– Add<br />
– Update<br />
– Delete<br />
Client/Server Structure<br />
Taking advantage of Web technologies<br />
Shanghai Baosight Information Technology Corporation Ltd.
Advantages of Web-based Web based <strong>OLTP</strong><br />
Only Web browser needed on client<br />
Software distribution<br />
Version control<br />
System management<br />
“block mode with pictures”<br />
Via private network, or even over Internet<br />
Shanghai Baosight Information Technology Corporation Ltd.
Essential items for Web-based Web based<br />
<strong>OLTP</strong> system developing tools<br />
Data with integrity definitions<br />
Multi-user environment<br />
Methods to author data on Web<br />
High system performance<br />
Security control<br />
Access audit<br />
Shanghai Baosight Information Technology Corporation Ltd.
Web-based Web based <strong>OLTP</strong> using <strong>SAS</strong><br />
Shanghai Baosight Information Technology Corporation Ltd.
Data with integrity definitions<br />
Multi-user environment<br />
Methods to author data on Web<br />
High system performance<br />
Security control<br />
Access audit<br />
Shanghai Baosight Information Technology Corporation Ltd.
Integrity constraints<br />
A set of rules that modifications to data sets<br />
(or tables) must follow in order to guarantee<br />
the validity of the data.<br />
Is essential to <strong>OLTP</strong> system<br />
Two types:<br />
– general constraints (one table)<br />
– referential constraints (two or more tables)<br />
Shanghai Baosight Information Technology Corporation Ltd.
How <strong>SAS</strong> supports integrity<br />
Since v7<br />
constraints<br />
PROC DATASETS<br />
PROC SQL<br />
others, as SCL functions …<br />
Shanghai Baosight Information Technology Corporation Ltd.
Example<br />
proc sql noprint;<br />
create table staff<br />
( id char(5) label='ID number' not null,<br />
name char(20) label='Name' not null,<br />
sex char(1) label='Sex' not null check<br />
( sex in (‘F’ ‘M’)),<br />
age num label='Age' not null check<br />
( age between 1 and 100 ),<br />
salary num label='Salary',<br />
constraint pk_id primary key (id)<br />
);<br />
quit;<br />
Shanghai Baosight Information Technology Corporation Ltd.
List Constraints<br />
PROC DATASETS<br />
PROC SQL<br />
PROC CONTENTS<br />
others<br />
Shanghai Baosight Information Technology Corporation Ltd.
Example<br />
proc sql noprint;<br />
describe table constraints staff;<br />
quit;<br />
Shanghai Baosight Information Technology Corporation Ltd.
Example (continued)<br />
-----Alphabetic List of Integrity Constraints-----<br />
Integrity Where<br />
# Constraint Type Variables Clause<br />
-------------------------------------------------------------------------------------------------<br />
1 _CK0001_ Check sex in ('F', 'M')<br />
2 _CK0002_ Check ((age>=1 and age
RC<br />
0<br />
4<br />
8<br />
12<br />
16<br />
24<br />
28<br />
SQL Return Codes<br />
DESCRIPTIONS<br />
Completed successfully with no errors.<br />
The statement executed, but there is a warning.<br />
Encountered an error. The statement stopped execution.<br />
Encountered an internal error during compile time.<br />
Encountered a user error during run time.<br />
Encountered a system error during run time.<br />
Encountered an internal error during run time.<br />
Shanghai Baosight Information Technology Corporation Ltd.
Macro variable<br />
&SQLRC<br />
Contains the return code from an SQL<br />
statement.<br />
=8, failure execution<br />
=24, an integrity conflict occurs<br />
Shanghai Baosight Information Technology Corporation Ltd.
Data with integrity definitions<br />
Multi-user environment<br />
Methods to author data on Web<br />
High system performance<br />
Security control<br />
Access audit<br />
Shanghai Baosight Information Technology Corporation Ltd.
<strong>SAS</strong> data set (table)<br />
Fundamentally a file in OS<br />
Do not provide lock mechanism itself<br />
Two users can not update the same table at<br />
the same time (even with different records)<br />
Shanghai Baosight Information Technology Corporation Ltd.
<strong>SAS</strong>/Share®<br />
<strong>SAS</strong>/Share<br />
Provides a multi-user environment<br />
Permits concurrent access<br />
Is transparency for application developer<br />
Is easy to administrate the server<br />
Shanghai Baosight Information Technology Corporation Ltd.
Data with integrity definitions<br />
Multi-user environment<br />
Methods to author data on Web<br />
High system performance<br />
Security control<br />
Access audit<br />
Shanghai Baosight Information Technology Corporation Ltd.
<strong>SAS</strong>/IntrNet® <strong>SAS</strong>/IntrNet Components<br />
Application Dispatcher<br />
htmSQL<br />
MDDB report Viewer<br />
<strong>SAS</strong>/CONNECT Driver for JAVA<br />
others<br />
Shanghai Baosight Information Technology Corporation Ltd.
Application Dispatcher<br />
One component of <strong>SAS</strong>/IntrNet<br />
CGI<br />
Flexible to program with utilities<br />
<strong>SAS</strong> not required on user’s machine<br />
Shanghai Baosight Information Technology Corporation Ltd.
Web Server<br />
Br oker<br />
Diagram of the Process<br />
Web Browser<br />
Application<br />
Ser ver<br />
<strong>SAS</strong><br />
Pr ogr am<br />
Shanghai Baosight Information Technology Corporation Ltd.<br />
Shar e<br />
Ser ver<br />
DATA
Data with integrity definitions<br />
Multi-user environment<br />
Methods to author data on Web<br />
High system performance<br />
Security control<br />
Access audit<br />
Shanghai Baosight Information Technology Corporation Ltd.
How to improve system<br />
performance<br />
Powerful server<br />
High bandwidth of network<br />
etc.<br />
Shanghai Baosight Information Technology Corporation Ltd.
For application developers<br />
Deploy a few application servers<br />
Moderate the amount of data transferring<br />
over network<br />
Check data validity at client side<br />
Predict the frequency of user requests<br />
Shanghai Baosight Information Technology Corporation Ltd.
Data with integrity definitions<br />
Multi-user environment<br />
Methods to author data on Web<br />
High system performance<br />
Security control<br />
Access audit<br />
Shanghai Baosight Information Technology Corporation Ltd.
Tips on security control<br />
Authenticate the Broker<br />
Program with SCL or compiled macro code<br />
Supply a password to start application server<br />
Restrict access to program libraries<br />
Check _RMTUSER and _RMTADDR if<br />
necessary<br />
Elaborately test application programs<br />
Shanghai Baosight Information Technology Corporation Ltd.
Data with integrity definitions<br />
Multi-user environment<br />
Methods to author data on Web<br />
High system performance<br />
Security control<br />
Access audit<br />
Shanghai Baosight Information Technology Corporation Ltd.
Audit trails<br />
Necessary for mission critical systems<br />
Usually done in application program with<br />
extra codes<br />
Additional application to maintain auditing<br />
data<br />
Shanghai Baosight Information Technology Corporation Ltd.
Since v8<br />
<strong>SAS</strong> auditing<br />
Define once, benefit always<br />
PROC DATASETS ;<br />
AUDIT <strong>SAS</strong>-file-name ;<br />
INITIATE;<br />
<br />
<br />
<br />
Shanghai Baosight Information Technology Corporation Ltd.
List contents of audit file<br />
proc contents data=mylib.myfile (type=audit);<br />
run;<br />
Shanghai Baosight Information Technology Corporation Ltd.
List data of audit file<br />
proc print data=mylib.myfile (type=audit)<br />
run;<br />
Shanghai Baosight Information Technology Corporation Ltd.
A Web-based Web based <strong>OLTP</strong> system<br />
using <strong>SAS</strong><br />
Shanghai Baosight Information Technology Corporation Ltd.
PAC in Baosteel<br />
PAC - Production Administration Center<br />
Charges production of the whole company<br />
Traces the up-to-date production conditions<br />
Coordinates the different departments<br />
Holds executives’ routine meeting<br />
Shanghai Baosight Information Technology Corporation Ltd.
Former MIS system<br />
Developed by Foxpro<br />
Long waiting period while authoring<br />
information<br />
Difficult to distribute information all over<br />
the corporation<br />
Too much paper for report print<br />
Shanghai Baosight Information Technology Corporation Ltd.
PAC MIS<br />
A Web-based <strong>OLTP</strong> system using <strong>SAS</strong><br />
Collects part of data from Baosteel EDW<br />
Can manually maintain data<br />
Automatically or manually generate reports<br />
and graphics for routine meeting and<br />
management<br />
Shanghai Baosight Information Technology Corporation Ltd.
Diagram of System Structure<br />
IBM 9672<br />
OS/ 390<br />
DB2<br />
PAC Net wor k<br />
Wi n98<br />
IE5.0<br />
Intranet<br />
Backbone<br />
IBM SP<br />
AI X 4. 3<br />
Domino Web Server<br />
<strong>SAS</strong> V8<br />
PAC MIS Application<br />
Shanghai Baosight Information Technology Corporation Ltd.<br />
Baost eel<br />
Ent er pr i s e<br />
Da t a<br />
War ehouse<br />
PAC<br />
Da t a
A Sample Map from PAC MIS<br />
Shanghai Baosight Information Technology Corporation Ltd.
Response from users<br />
Faster then ever to access the report<br />
Flexible to maintain data<br />
Easy for authentication<br />
Can be accessed anywhere on Baosteel<br />
intranet, or even at home<br />
Less paper required anymore<br />
Shanghai Baosight Information Technology Corporation Ltd.
Sample <strong>SAS</strong> program<br />
Shanghai Baosight Information Technology Corporation Ltd.
Program structure<br />
%macro initmap(d,msg,err)<br />
– initialized the map each time operations finished<br />
%macro process<br />
– main process for 4 types of operation<br />
Shanghai Baosight Information Technology Corporation Ltd.
Use <strong>SAS</strong>/Share server<br />
libname gzdata '/home2/dev_sc/gzdata'<br />
server=bg_sp04.sharesvr;<br />
Shanghai Baosight Information Technology Corporation Ltd.
%macro process<br />
%if not %sysfunc(exist(&dsn)) %then<br />
create table with integrity constraints<br />
%if &flag ne 1 %then %initmap for the first<br />
time<br />
Shanghai Baosight Information Technology Corporation Ltd.
%macro process (cont.)<br />
%if "&submit"=“QUERY" %then<br />
proc SQL noprint;<br />
select * from &dsn where …<br />
quit;<br />
decide &sqlrc and process<br />
%initmap<br />
Shanghai Baosight Information Technology Corporation Ltd.
%macro process (cont.)<br />
%if "&submit"="DELETE" %then<br />
proc SQL noprint;<br />
delete * from &dsn where …<br />
quit;<br />
decide &sqlrc and process<br />
%initmap<br />
Shanghai Baosight Information Technology Corporation Ltd.
%macro process (cont.)<br />
%if "&submit"=“ADD" %then<br />
proc SQL noprint;<br />
insert into &dsn values …<br />
quit;<br />
decide &sqlrc and process<br />
%initmap<br />
Shanghai Baosight Information Technology Corporation Ltd.
%macro process (cont.)<br />
%if "&submit"=“UPDATE" %then<br />
proc SQL noprint;<br />
update &dsn …<br />
quit;<br />
decide &sqlrc and process<br />
%initmap<br />
Shanghai Baosight Information Technology Corporation Ltd.
Conclusions<br />
Shanghai Baosight Information Technology Corporation Ltd.
Conclusions<br />
With <strong>SAS</strong>/IntrNet®, <strong>SAS</strong>/Share® and new<br />
features in Base <strong>SAS</strong>, <strong>SAS</strong> can be of an<br />
ideal tool to develop Web-based <strong>OLTP</strong><br />
system<br />
Shanghai Baosight Information Technology Corporation Ltd.
The Road Ahead<br />
Not a “pure” RDBMS<br />
– System performance<br />
– Security control<br />
– Mulit-user environment<br />
SQL return code should be enhanced<br />
Shanghai Baosight Information Technology Corporation Ltd.
<strong>SAS</strong>/IntrNet®, <strong>SAS</strong>/IntrNet , <strong>SAS</strong>/Share®<br />
<strong>SAS</strong>/Share<br />
are registered trademarks of<br />
<strong>SAS</strong> Institute Inc., Cary, NC.<br />
Shanghai Baosight Information Technology Corporation Ltd.
Thank you!<br />
Shanghai Baosight Information Technology Corporation Ltd.
Haidong Tang<br />
Contact Information<br />
Data Strategies Dept.<br />
Shanghai Baosight Information Technology<br />
Corporation Ltd.<br />
Email: tanghaidong@baosight.com<br />
hdtang@263.net<br />
Shanghai Baosight Information Technology Corporation Ltd.
Questions?<br />
Questions<br />
Shanghai Baosight Information Technology Corporation Ltd.
1. Abstract<br />
<strong>WEB</strong>-<strong>BASED</strong> <strong>OLTP</strong> <strong>SYSTEM</strong> <strong>USING</strong> <strong>SAS</strong><br />
Haidong Tang, Data Strategies Dept.,<br />
Shanghai Baosight Information Technology Corp., China<br />
<strong>OLTP</strong> (Online Transaction Processing) processing has a long history and has been widely used<br />
these days. However, as the development of Web technologies, people may tend to migrate these<br />
traditional <strong>OLTP</strong> systems to Web. Depending on its Web-enabled technologies, <strong>SAS</strong> software<br />
Version 8 has become an ideal tool to develop Web-based <strong>OLTP</strong> system.<br />
This paper will introduce the common essential items to realize a Web-based <strong>OLTP</strong> system and<br />
the ways <strong>SAS</strong> software can take to implement such systems. It will discuss in details about the<br />
technologies employed mainly from the view of an application developer. And it will also give an<br />
example of an accomplished Web-based <strong>OLTP</strong> system at Shanghai Baosteel in China.<br />
2. Introduction<br />
Why Web-based <strong>OLTP</strong><br />
<strong>OLTP</strong> is the automation of high-volume, repetitive business processes. These types of transactions<br />
include short records of a few fields, such as short descriptions, numbers and dates. For end users,<br />
functions as query, insertion, modification and deletion are an <strong>OLTP</strong> system may provide to<br />
manipulate data. Classic examples of <strong>OLTP</strong> system are Airline Seat Bookings, ATM Withdrawals,<br />
Production Process Control Systems and Management Information Systems.<br />
These traditional <strong>OLTP</strong> systems are based on centralized hosts or C/S platforms with private<br />
network. This kind of structure may have the some specific advantages as very little downtime and<br />
high security. However, there are always drawbacks for version control, system management and<br />
application extension, etc.<br />
Web-based <strong>OLTP</strong> system bases on C/S structure, which takes advantage of the Web technologies.<br />
The Web server is the center of application code and data, and only the Web browsers are required<br />
on remote workstations. Comparing with the traditional ones, Web-based <strong>OLTP</strong> systems provide<br />
end users interfaces of “block mode with pictures”, which is more attractive and easy to handle for<br />
end users. In Web-based <strong>OLTP</strong> system, issues of software distribution, version control, and system<br />
management turn out to be easier. End users can access the server via a private network or over<br />
the Internet through their ISPs.<br />
As there are so many advantages to take Web-based <strong>OLTP</strong> system, <strong>SAS</strong> developers are likely to<br />
adopt <strong>SAS</strong> software as a tool for developing Web-based <strong>OLTP</strong> systems.<br />
Essential items for <strong>OLTP</strong> systems<br />
Today, there are various Web-based <strong>OLTP</strong> systems developed using various developing tools.<br />
Examples of Web-based <strong>OLTP</strong> systems can be Travel Reservations, Online Stock Trading, Home<br />
Banking and MIS. But what are the common essential items of these systems?<br />
From the view of an application developer, following aspects should be taken into considerations<br />
while designing Web-based <strong>OLTP</strong> system.<br />
a. Data with integrity definitions, which reflect the real world situations;
. A multi-user environment for users query and update data simultaneously;<br />
c. Methods for authoring data on Web;<br />
d. High system performance, which means high-volume data with quick response time;<br />
e. Security control;<br />
f. Access audit.<br />
To develop a Web-based system using <strong>SAS</strong> software, <strong>SAS</strong> should have some corresponding<br />
methods to implement all these items. Actually ever since Version 8, <strong>SAS</strong> software has become an<br />
ideal tool for developing Web-based <strong>OLTP</strong> systems. Well, let’s take a close look at all these items<br />
and the way we can go.<br />
3. <strong>WEB</strong>-<strong>BASED</strong> <strong>OLTP</strong> <strong>USING</strong> <strong>SAS</strong><br />
Define data with integrity constraints<br />
Integrity constraints, which are essential for <strong>OLTP</strong>, are a set of rules that modifications to data sets<br />
(or tables) must follow in order to guarantee the validity of the data. Though not a “pure”<br />
relational database system, <strong>SAS</strong> now supports integrity constraints quite well. There are several<br />
flexible ways to create and delete integrity constraints, such as the DATASETS procedure, the<br />
SQL procedure, and SCL functions. Among all these ways we prefer the SQL procedure, for SQL<br />
is a standard way to access data and may easy for migration between different systems. For detail<br />
descriptions of constraints definitions, please refer “<strong>SAS</strong> Online Document V8”.<br />
Here is an example of creating a table of STAFF with integrity constraints:<br />
proc sql noprint;<br />
create table staff<br />
( id char(5) label='ID number' not null,<br />
name char(20) label='Name' not null,<br />
sex char(1) label='Sex' not null check ( sex in (‘F’ ‘M’)),<br />
age num label='Age' not null check ( age between 1 and 100 ),<br />
salary num label='Salary',<br />
constraint pk_id primary key (id)<br />
);<br />
quit;<br />
The constraints as “primary key”, “not null” and “check” guarantee the consistency of the table<br />
STAFF. For example, the constraint PK_ID guarantees there will always be a unique ID number.<br />
It is obvious that these kinds of constraint are essential to an <strong>OLTP</strong> system, as they make data<br />
comply with the rules in real world situations. By capturing the SQL return codes, we can do<br />
further jobs on data processing. In <strong>SAS</strong>, the macro variable &SQLRC contains the status values<br />
after the SQL procedure statement has been executed.<br />
Though not detailed classified as in other database products, the available SQL return codes are as<br />
followed.<br />
0 Completed successfully with no errors.<br />
4 The statement executed, but there is a warning.<br />
8 Encountered an error. The statement stopped execution.<br />
12 Encountered an internal error during compile time.<br />
16 Encountered a user error during run time.<br />
24 Encountered a system error during run time.<br />
28 Encountered an internal error during run time.<br />
Generally, a return code greater than or equal to 8 can be considered as a failure execution of the<br />
statement. And once there is an integrity conflict, system returns 24.<br />
So when the same ID inserts to table STAFF, or there are some other integrity conflict happens,
the execution will abort with a return code &SQLRC=24. Therefore, the application can prompt a<br />
proper message for end users to take further actions on their data.<br />
To list all the constraints in a data set, use PROC CONTENTS or PROC SQL. For example,<br />
proc sql noprint;<br />
describe table constraints staff;<br />
quit;<br />
The constraints of table STAFF is as followed:<br />
-----Alphabetic List of Integrity Constraints-----<br />
Integrity Where<br />
# Constraint Type Variables Clause ----------------------------------------------------<br />
----------------------------------------------------------------------------------<br />
1 _CK0001_ Check sex in ('F', 'M')<br />
2 _CK0002_ Check ((age>=1 and age
Web<br />
Browser<br />
Web<br />
Server<br />
Broker<br />
CGI<br />
User of Web-based <strong>OLTP</strong> system sends a request for application program to Web Server;<br />
Broker CGI of the <strong>SAS</strong>/IntrNet® then dispatches the request to the <strong>SAS</strong> Application Server;<br />
The Application Server invokes the Application Program and passes parameters to it;<br />
The Application Program then adds, updates, deletes or queries data through a share server;<br />
The Application Program returns an HTML page with operation status to Web Server;<br />
Web Server returns the final page to user.<br />
For more information on Application Dispatcher, please consult “<strong>SAS</strong> Online Document V8”.<br />
High system performance<br />
Application<br />
Server(s)<br />
Application<br />
Program<br />
Share<br />
Server<br />
System performance, especially response time, is very sensitive to end users. Web-based <strong>OLTP</strong><br />
system does have some weaknesses concerning this issue, as transaction predictability is far from<br />
a reality. It is certain that relying on powerful Web servers for high-volume processing and high<br />
bandwidth of network for heavy traffic, the painful problem could be eased. However, from the<br />
application developer side, some measures still can be taken under a certain decided system<br />
environment.<br />
a. Deploy a few Application Servers<br />
<strong>SAS</strong> application server provides three types of service: socket, pool and launch. To improve the<br />
response time, it is suggested that socket service with more application servers should be<br />
deployed. As the servers are running by the time client requests appears, clients do not have to<br />
wait for a server to start. It is quite effective in a multi-user environment.<br />
b. Moderate the amount of data transferring over network<br />
How much data can be placed on one application map? As much as one wants once he uses POST<br />
method instead of GET. How much would be appropriate? No exact answers. But the fact is, the<br />
more data the user operates at a time, the slower response time it will be. So it is important to<br />
moderate the amount of data transferring over network according to the real situation.<br />
Instead of placing a large amount of data on one map, it can be shared in several consecutive maps<br />
with separated transactions to operate. Therefore there are normally two ways to fulfill the task,<br />
Saving information in a temporarily <strong>SAS</strong> data set on server;<br />
Using SESSION in Version 8.0.<br />
c. Check data validity at client side<br />
It is suggested that all data transferred to server should be correct in format and in content if it is<br />
possible. JavaScript or VBScript therefore can be assisted in checking the data validity before a<br />
Web form is submitted.<br />
d. Predict the frequency of user requests<br />
Users may use the application in a varied period of time. It is necessary to predict the frequency of<br />
user requests at different time period, so that some effective measures can be taken to avoid traffic<br />
jam.<br />
Data
Security control<br />
Security is always a very thorny issue for Web applications. It is a complex issue that may concern<br />
user authentication, authorization, communications security and writing secure applications.<br />
Mentioned here are a few,<br />
a. Authenticating the Broker in a Web server, so that only authenticated users can invoke Broker<br />
to use the applications;<br />
b. Using SCL or compiled macro code to prevent user from reading the source program under<br />
with _DEBUG=131;<br />
c. Supplying a password when starting the application server;<br />
d. Restricting access to program libraries;<br />
e. Checking _RMTUSER and _RMTADDR to establish a user defined access control if it is<br />
necessary;<br />
f. Test the applications carefully before being put into production, so as to prevent any “back<br />
doors” in application programs.<br />
Audit trial<br />
For mission critical <strong>OLTP</strong> system, audit trial is a necessity. In traditional <strong>OLTP</strong> system, this is<br />
done with additional code in application programs. For example, after a successful deletion<br />
(decided by SQL return code), we may insert the record, with additional information as operator<br />
id, time of operation, to an audit table. Having been enhanced, <strong>SAS</strong> V8 itself enables to log<br />
updates to a <strong>SAS</strong> data file in a separate audit file each time an observation is added, deleted, or<br />
updated. This means information will be automatically added to the audit file about who made the<br />
modification, what was modified, and when.<br />
The audit trail is initiated with the AUDIT statement in PROC DATASETS.<br />
PROC DATASETS ;<br />
AUDIT <strong>SAS</strong>-file-name ;<br />
INITIATE;<br />
<br />
<br />
<br />
The following example code shows the way to create the audit file MYLIB.MYFILE.AUDIT to<br />
log updates to the data file MYLIB.MYFILE.DATA, storing all available record images.<br />
proc datasets library=MyLib;<br />
audit MyFile alter=MyPassword;<br />
initiate;<br />
run;<br />
PROC CONTENTS can be used to review the contents:<br />
proc contents data=Mylib.Myfile (type=audit);<br />
run;<br />
To check the audit file, use PROC PRINT:<br />
proc print data=Mylib.Myfile (type=audit)<br />
run;<br />
4. A <strong>WEB</strong>-<strong>BASED</strong> <strong>OLTP</strong> <strong>SYSTEM</strong> <strong>USING</strong> <strong>SAS</strong>
Situation<br />
Shanghai Baosteel is the largest and the most advanced iron and steel making corporation in<br />
China. Production Administration Center (PAC) at Baosteel is the department that charges<br />
everyday production of the whole corporation. It keeps on tracing the up-to-date production<br />
conditions and coordinates the different departments upon the information that they get.<br />
Meanwhile, there is a routine meeting for executives to make decisions upon information gathered<br />
by PAC.<br />
PAC used to depend on a system of Foxpro to fulfill its duty. The users complained that,<br />
a. Long waiting period while authoring information at the executives routine meetings;<br />
b. Difficult to distribute information all over the corporation;<br />
c. Too much paper for report printing.<br />
System introduction<br />
The Web-based Management Information System for Production Administration Center (PAC<br />
MIS) is a system developed using <strong>SAS</strong> software. PAC MIS automatically grabs the required data<br />
from data warehouse by a batch job in midnight, and later users at PAC still can manually<br />
maintain the data on Web. Almost reports and analytic graphics for executives’ meeting and daily<br />
management can be generated manually or automatically in HTML files, which are directly<br />
authored from Web server.<br />
The whole system has been deployed on IBM SP, an admitted mission critical machine for highvolume<br />
processing. The IBM SP has been linked to Baosteel ATM backbone, while IBM Domino<br />
Web server, <strong>SAS</strong> V8 for AIX and related software have been installed on it. As the enterprise data<br />
warehouse has been built on the same machine using <strong>SAS</strong> software, it provides an ideal data<br />
source environment for PAC MIS.<br />
The following diagram illustrates the system configuration.<br />
Data warehouse<br />
Baosteel Intranet<br />
100M ATM Backbone Batch job<br />
IBM<br />
SP<br />
<strong>SAS</strong> V8<br />
Domino Web server<br />
PAC MIS applications<br />
<strong>OLTP</strong> data<br />
PAC<br />
Users MS IE5.0 / Windows 98<br />
PAC MIS consists of four subsystems, which are the information authoring, the authentication<br />
management, the online data management and the batch job. The online data management<br />
subsystem is designed and established on Web-based <strong>OLTP</strong> concept, and is the core of the whole<br />
system.<br />
One map in the online data maintenance subsystem has been showed below. Authenticated users<br />
can easily query, add, update and delete the daily raw material data on their browsers.
Response from user<br />
After PAC MIS has been finished and put into production, it receives high reputation from users.<br />
Comparing with the old system, PAC MIS has the following advantages.<br />
a. Faster to access the report, as most of them have already been generated in HTML files;<br />
b. Flexible to maintain data;<br />
c. Easy for authentication;<br />
d. Can be accessed anywhere on Baosteel intranet, or even at home through a telephone line;<br />
e. Less paper required anymore.<br />
5. CONCLUSIONS<br />
With <strong>SAS</strong>/IntrNet®, <strong>SAS</strong>/Share®, <strong>SAS</strong> can be of great tool to develop Web-based <strong>OLTP</strong> system.<br />
However, it is still a long way to go for establishing mission critical <strong>OLTP</strong> systems. For <strong>SAS</strong>, not<br />
a “pure” RDBMS, may appear to be less effective in handling large amount of data and be a little<br />
bit awkward for users accessing through <strong>SAS</strong>/Share®. <strong>SAS</strong> has its flexible enhanced SQL, but the<br />
return code has been superficially classified, which can lead to some ambiguities.<br />
<strong>SAS</strong> has now announced its <strong>SAS</strong>/SPDS® for higher performance, better access control.<br />
Depending on high performance machine, it can be convincing that applying <strong>SAS</strong>/SPDS® into<br />
Web-based <strong>OLTP</strong> system will be of great help to ease some of the issues.<br />
6. CONTACT INFORMATION<br />
The author can be contacted at:<br />
Haidong Tang<br />
Baosight Corporation
No. 688 Fujin Road, Baoshan District<br />
201900 Shanghai<br />
P.R.China<br />
Email: tanghaidong@baosight.com<br />
7. REFERENCES<br />
<strong>SAS</strong> Online Document, V8 <strong>SAS</strong> Institute Inc., Cary, NC.<br />
Application Dispatcher, Version 8.0 http://www.sas.com/rnd/web/intrnet/dispatch/index.html<br />
<strong>SAS</strong>/IntrNet®, <strong>SAS</strong>/Share®, <strong>SAS</strong>/SPDS® are registered trademarks of <strong>SAS</strong> Institute Inc., Cary,<br />
NC.<br />
8. APPENDIX – A SAMPLE <strong>SAS</strong> PROGRAM<br />
Following is the program showing query, addition, update, and deletion in a Web-based <strong>OLTP</strong><br />
system. It is a <strong>SAS</strong> program, but it is recommended to apply SCL program for a production<br />
system. To be clarity in structure, it also has been tailored from the original code.<br />
%macro initmap(d,msg,err);<br />
data _null_;<br />
file _webout;<br />
format dt datetime.;<br />
length s $ 200;<br />
msg=symget('msg');<br />
yyyymmdd=symget('yyyymmdd');<br />
dt=symget('dt');<br />
dd=symget('dd');<br />
tt=symget('tt');<br />
put 'Content-type: text/html';<br />
put;<br />
put '';<br />
put '';<br />
put 'PAC – RAW MATERIAL DATA';<br />
put '';<br />
put '';<br />
put '';<br />
put '';<br />
put 'PAC MIS (MAP 1)';<br />
put 'RAW MATERIAL MANAGEMENT';<br />
put '' dd tt '';<br />
/* change GET into POST when put into production */<br />
put '';<br />
put '';<br />
put '
* application server service name */<br />
put '';<br />
/* program name */<br />
put '';<br />
/* debug status */<br />
put '';<br />
put '';<br />
put '';<br />
s='DATE: ';<br />
put s;<br />
put 'UNIT: TONS';<br />
put '';<br />
put '';<br />
put ' ';<br />
put 'TODAY';<br />
put 'ACCUMULATED';<br />
put 'STORAGE';<br />
put '';<br />
put '';<br />
put 'IRON ORE';<br />
s='';<br />
put s;<br />
s='';<br />
put s;<br />
s='';<br />
put s;<br />
put '';<br />
put '';<br />
put '';<br />
put "";<br />
put "";<br />
put "";<br />
put "";<br />
run;<br />
%mend initmap;<br />
%macro process;<br />
/* Create a table with integrity constraints */<br />
%if not %sysfunc(exist(&dsn)) %then<br />
%do;<br />
proc sql noprint;<br />
create table &dsn<br />
(date_prc char(8) format=$8. label='processing date' primary key,<br />
QUANT_Iron_day num format=11. label='day iron ore' check (quant_iron_day between 1 and 1000 ),<br />
QUANT_Iron_acc num format=11. label='acc iron ore' check (quant_iron_acc between 1 and 10000 ),<br />
QUANT_Iron_store num format=11. label='str iron ore' check (quant_iron_store between 1 and 10000<br />
),
last_upd num format=datetime22. label='date last update' not null,<br />
_rmtuser char(36) format=$36. label='user operated' not null,<br />
_rmtaddr char(15) format=$15. label='IP address' not null);<br />
quit;<br />
%end;<br />
/* first time the program be called */<br />
%if &flag ne 1 %then<br />
%do;<br />
%initmap(0,Welcome to PAC MIS!);<br />
%goto endproc;<br />
%end;<br />
/* user pressed QUERY button on the map */<br />
%if "&submit"="QUERY" %then<br />
%do;<br />
%initmap(&date_prc,QUERY FINISHED!);<br />
%goto endproc;<br />
%end;<br />
/* user pressed DELETE button on the map */<br />
%if "&submit"="DELETE" %then<br />
%do;<br />
proc sql noprint;<br />
delete * from &dsn where date_prc="&date_prc";<br />
quit;<br />
%if &sqlrc ge 8 %then %do; %initmap(0,ERROR WHILE DELETE! SQLRC=&sqlrc,1); %end;<br />
%goto endproc;<br />
%end;<br />
/* user pressed ADD button on the map */<br />
%if "&submit"="ADD" %then<br />
%do;<br />
proc sql noprint;<br />
insert into &dsn values<br />
(date_prc=“&date_prc”,<br />
quant_iron_day=&QUANT_Iron_day,<br />
QUANT_Iron_acc=&QUANT_Iron_acc,<br />
QUANT_Iron_store=&QUANT_Iron_store,<br />
last_upd=“&last_upd”,<br />
_rmtuser=“&_rmtuser”,<br />
_rmtaddr=“&_rmtaddr”<br />
);<br />
quit;<br />
%if &sqlrc=24 %then<br />
%do; %initmap(&date_prc,&date_prc%str(DATA ALREADY EXIST!),1); %goto endproc; %end;<br />
%if &sqlrc ge 8 %then<br />
%do; %initmap(&date_prc,ERROR WHILE ADDING! (SQLRC=&sqlrc),1); %goto endproc;<br />
%end;<br />
%initmap(&date_prc,ADD FINISHED!);<br />
%goto endproc;<br />
%end;<br />
/* user pressed UPDATE button on the map */<br />
%if "&submit"="UPDATE" %then
%do;<br />
proc sql noprint;<br />
update &dsn<br />
set<br />
(date_prc=“&date_prc”,<br />
quant_iron_day=&QUANT_Iron_day,<br />
QUANT_Iron_acc=&QUANT_Iron_acc,<br />
QUANT_Iron_store=&QUANT_Iron_store,<br />
last_upd=“&last_upd”,<br />
_rmtuser=“&_rmtuser”,<br />
_rmtaddr=“&_rmtaddr”<br />
)<br />
where date_prc="&date_prc";<br />
quit;<br />
%if &sqlrc ge 8<br />
%then %do; %initmap(&date_prc,ERROR WHILE UPDATE! (SQLRC=&sqlrc),1); %goto<br />
endproc; %end;<br />
%initmap(&date_prc,UPDATE FINISHED!);<br />
%end;<br />
%endproc:<br />
%mend process;<br />
/*--------------------------------------------*/<br />
/* The program runs from here! */<br />
/*--------------------------------------------*/<br />
%global flag yyyymmdd dt last_upd dd tt;<br />
/* access data through a share server */<br />
libname gzdata '/home2/dev_sc/gzdata' server=sharesvr;<br />
%let dsn=gzdata.gz0001;<br />
/* check if the user has the access right, decided by _RMTUSER */<br />
%checkuser(PACUSER);<br />
data _null_;<br />
yyyymmdd=compress(put(date(),yymmdd10.),'-');<br />
dd=put(date(),yymmdd10.);<br />
tt=put(time(),time8.);<br />
dt=datetime();<br />
last_upd=datetime();<br />
call symput('yyyymmdd',yyyymmdd);<br />
call symput('dt',dt);<br />
call symput('dd',dd);<br />
call symput('tt',tt);<br />
call symput('last_upd',last_upd);<br />
run;<br />
%process;