Chapter Contents


SAS/ACCESS Interface to SYSTEM 2000 Data Management Software: Reference

How the SAS/ACCESS Interface to SYSTEM 2000 Software Works

When you use the ACCESS procedure to create an access descriptor file, the SAS System calls SYSTEM 2000 software to get a description of the database. When you create a view descriptor file, the SAS System has information about the database in the access descriptor, so it does not call SYSTEM 2000 software.

The ACCESS procedure writes the descriptor files to a SAS data library. Then, when you use a SAS procedure with a view descriptor whose data is in a SYSTEM 2000 database, the SAS System Supervisor calls the interface view engine to access the data. The engine can access a database for reading, updating, inserting, and deleting.

The connections between the SAS/ACCESS procedures and the SYSTEM 2000 software are shown in How the SAS System Connects to SYSTEM 2000 Software.

How the SAS System Connects to SYSTEM 2000 Software


How the SYSTEM 2000 Interface View Engine Works

The interface view engine is a PLEX (Programming Language Extension) applications program, which retrieves and updates data in a SYSTEM 2000 database. Calls to the engine are in one of the following categories:

In all situations, the same PLEX commands initiate and terminate communication between the interface view engine and SYSTEM 2000 software. Each time a different SAS procedure requires use of SYSTEM 2000 software, it makes an initialization call to the engine. This first call establishes communication with SYSTEM 2000 software and opens the requested database.

The engine determines whether it must issue the START S2K command for a single-user job or the Multi-User environment, as specified by the calling SAS procedure. Then it issues an OPEN command for the specified database and returns control to the procedure. Additional calls to the engine perform retrieval and update operations required by the SAS procedure.

When the SAS procedure terminates, the engine issues a CLOSE command for the database that was opened. It issues the STOP S2K command only when the entire SAS session terminates, or when you want to run the QUEST procedure in the same environment (single user or Multi-User) that SAS programs have been running in.

Calls Made on Behalf of the ACCESS Procedure

The ACCESS procedure calls the interface view engine to retrieve item and record information for a specified database. The engine sends the component number, name, type, picture, level number, and key status (along with the database cycle number and so on) back to the procedure for each item and record in the database. The procedure stores this information in the access descriptor for later use when creating view descriptors.

Also, if you are using the ACCESS procedure to extract information into a SAS data file, the ACCESS procedure calls the engine.

Calls Made on Behalf of the DBLOAD Procedure

When you create a new database, the DBLOAD procedure always creates an access descriptor and a view descriptor.

When you insert data into an existing SYSTEM 2000 database, you must specify an appropriate view descriptor in the DBLOAD procedure. The view descriptor provides a mapping between the SAS variables containing data to be inserted and the SYSTEM 2000 components that will be used to insert the data into the database. It also contains the database name, password, and access mode to be used when you do inserts.

For each observation that is retrieved from the data file specified on the DATA= option, a corresponding call is made to the interface view engine. The engine inserts the data into the database identified by the view descriptor. The engine uses only insert mode (one at a time) for inserting new descendant records into existing logical entries. Also, if the DATA= option identifies a SYSTEM 2000 view descriptor, the interface view engine is called to read that view.

When you load new logical entries (starting with records at level 0) into a database, you can specify that you want to use an optimized loading process. SYSTEM 2000 software processes the new logical entries as one batch of inserts (PLEX load mode). This optimized load mode is faster than inserting records one at a time. However, it causes the software to attach the database with exclusive use and no other database can be open in the same execution environment. Therefore, if your job is using optimized load, your input cannot also be a SYSTEM 2000 view descriptor of a database in the same environment.

Calls Made on Behalf of the QUEST Procedure

Usually the QUEST procedure communicates directly with SYSTEM 2000 software. When you enter SYSTEM 2000 statements (commands), they are processed immediately, and the results are sent back to you interactively. However, there is one exception. Each time you execute the QUEST procedure, it calls the engine to request permission to execute. If no other SAS programs are using the engine in the same environment, permission is granted. Otherwise, permission to execute is refused. Similarly, when the QUEST procedure terminates, it calls the engine to signal the event so that the engine will allow other SAS programs to execute. The engine does not allow SAS jobs to execute in the same environment while the QUEST procedure is running.

Calls Made by Other SAS Procedures

SAS procedures can access records in a SYSTEM 2000 database by referring to a view descriptor with the DATA= option. The SAS System examines the view descriptor to determine which database management system is referred to and passes control to the appropriate engine. The interface view engine uses information stored in the view descriptor (for example, access mode, password, database name, component numbers, levels, types, and so on) to process SYSTEM 2000 data records as if they were observations in a SAS data file.

Before doing any retrievals, the engine processes a PLEX dynamic where-clause (if specified) to select a subset of data records that are to be processed as observations. The engine constructs the dynamic where-clause from the view where-clause and the SAS WHERE clause (if any). If no view where-clause exists, a where-clause is constructed to locate all database records.

The dynamic where-clause processing returns a Locate File containing the addresses of database records that satisfied the selection criteria. Based on those addresses, the engine issues a combination of GET S2KCOUNT, GET1, and GETA commands to read one or more database records. Then the engine combines data from the records (according to the view descriptor) to form a SAS observation, which it passes back to the calling procedure for processing.

Based on the capabilities of the SAS procedure, the next call to the engine might be a request to update or delete the SAS observation that was just retrieved. For updates, the engine issues MODIFY, INSERT, REMOVE and so on for one or more data records, depending on how many records were used to construct the observation. Typically, the SAS procedure then calls the engine again to retrieve another SAS observation. If so, the engine locates another group of records, constructs another SAS observation, and returns it to the SAS procedure. This cycle continues until the SAS procedure terminates or until the last qualified SAS observation has been constructed and returned to the SAS procedure. In addition, the engine uses other commands, such as COMMIT, ROLLBACK, and CLEAR, to control processing.

Chapter Contents



Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.