190 likes | 406 Views
Why use... SAS/SHARE?. Andrew Ratcliffe Freelance SAS consultant Ratcliffe Technical Services Limited. Allow Concurrent Update Access to a Data Set.
E N D
Why use... SAS/SHARE? Andrew Ratcliffe Freelance SAS consultant Ratcliffe Technical Services Limited
Allow Concurrent Update Access to a Data Set If two users attempt to update the same data set at the same time, the second will be told that the data set is in use - even though he/she may wish to update a different record to the first user
Maintaining a Simple Look-Up Table • Pharms industry: table used for unit conversion • Use VIEWTABLE to maintain it • Updates must be single-threaded • Even with “Row Level Edit Access” • Update Mode: Record • CNTLLEV=RECORD
One at a Time
SAS/SHARE Permits Concurrent Access • Two (or more) users may open a data set for update at the same time • Only one user may edit/update an individual record at any point in time • Other users may browse the record at the same time
Others may browse at the same time This record cannot be updated at this time
build_d = open ('sasuser.build (cntllev=record)', 'U’ ); : rc=fetchobs (build_d, pointer ); if rc eq %sysrc(_SWNOUPD) then do; call send (_frame_, '_set_msg_', sysmsg() ); /* ... Prevent updates? ... */ end; else ... %macro sysrc(mac_name); !SASROOT\core\sasmacro : %let _SWNOUPD = -630054; /* This record cannot be updated at this */ /* time */
SAS/SHARE Makes Users Effective • If you need concurrent update access to one or more data sets: SAS/SHARE is a proven, effective solution
Release Observations • Clicking on another observation • Fetching another observation • UNLOCK() function • Lock two observations by opening the data set twice
Fully-supported Tried & tested Easily added to existing code Flexible Base SAS SAS/AF Data sets Catalog entries… Benefits
The Down-Side • All data access is done via the server • Server is a separate task • Increased response times • Added hardware expense? • Operational overhead
Start-Up: PROC OPERATE; START SERVER; Shut-Down: PROC OPERATE; QUIESCE SERVER; Operation: PROC OPERATE; ALLOCATE LIBRARY; Server: MVS job UNIX or NT process LAN requires PC A Few More Details
Configuration SAS code runs on SAS/SHARE clients SAS/SHARE server All data accessed by server task - wide security scope required Data
Protecting Inter-Related Data • Avoid deadly embraces by always accessing data elements in the same order • Use one data element as the access key Orders Accounts
Why not use… SAS/SHARE • “It costs money” • Low frequency of concurrent access • Data structures can be designed to avoid/minimise contention • Need non-volatile locking
Non-Volatile Locking • Prevent others’ access even whilst not actively accessing it yourself • Slowly progressing activities • Work-flow • Write your own locking mechanism
Close • Easy to overlook (or ignore) your need • Make your applications more resilient • A necessity for high-contention data • May not be the most appropriate solution • Alternative data architecture • Non-volatile locking
Any Questions? Andrew Ratcliffe SAS Institute Registered Consultant Ratcliffe Technical Services Limited Tel/fax: 01322-525672 Email: andrew@ratcliffe.demon.co.uk Web: http://www.ratcliffe.demon.co.uk