How the SAS/ACCESS Interface to CA-Datacom/DB Works

Overview for the Database Administrator

When you use the ACCESS procedure to create an access descriptor file, SAS calls CA-DATADICTIONARY to get a description of the database. When you create a view descriptor file, SAS has information about the database in the access descriptor, so it does not call CA-DATADICTIONARY.
The ACCESS procedure writes the descriptor files to a SAS library. Then, when you use a SAS procedure with a view descriptor whose data is in a CA-Datacom/DB table, SAS Supervisor calls the interface view engine to access the data. The engine can access a CA-Datacom/DB table for reading, updating, inserting, and deleting. The interface view engine accesses CA-DATADICTIONARY to validate the view descriptor.
When you update either an access descriptor or a view descriptor, SAS does not call CA-Datacom/DB or CA-DATADICTIONARY.
Note: Data records in a CA-Datacom/DB table cannot be accessed by number. That is, in SAS terms, a CA-Datacom/DB record is not addressable by row number. Therefore, various SAS procedures behave differently when accessing a CA-Datacom/DB table than they do when accessing a SAS data file. For example, the PRINT and FSEDIT procedures behave differently.
  • The PRINT procedure issues messages informing you that row numbers are not available and that the procedure has generated line numbers for its output. The numbers do not come from the CA-Datacom/DB table.
  • The FSEDIT procedure does not display a row number in the upper right corner of the window. If you try to enter a number on the command line, an error message appears.

Using the CA-Datacom/DB Interface View Engine

How the CA-Datacom/DB Interface View Engine Works

The interface view engine is an application program that retrieves and updates data in a CA-Datacom/DB table. Calls are in one of the following categories:
  • calls made on behalf of the ACCESS procedure when it is creating an access descriptor
  • calls made by a SAS DATA step or by SAS procedures that reference a view descriptor with the DATA= option
In all situations, the interface view engine initiates and terminates communication between the engine and CA-Datacom/DB. Each time a different SAS procedure requires use of CA-Datacom/DB, the program makes an initialization call to the engine. This first call establishes communication with CA-Datacom/DB. Additional calls to the engine perform retrieval and Update operations required by the SAS procedure.

Calls Made on Behalf of the ACCESS Procedure

The ACCESS procedure calls the interface view engine to retrieve information from the CA-DATADICTIONARY database about entity-occurrence names and attributes. The engine sends this information (for example, name, data type, level) to the ACCESS procedure for each field in the table. 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 and place them in a SAS data file, the ACCESS procedure calls the interface view engine.

Calls Made by Other SAS Procedures

SAS procedures can access records in a CA-Datacom/DB table by referring to a view descriptor with the DATA= option. SAS 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, field name, data type, key, level, and occurs specifications) to process CA-Datacom/DB data records as if they were rows in a SAS data file.
Before doing any retrievals, the engine processes the WHERE clause (if any) to select a subset of data records that are to be processed as rows. The engine constructs the selection criteria from the view WHERE clause and the SAS WHERE clause (if any). If no WHERE clauses exist, all data records in the table qualify.
The interface view engine forms a SAS row (according to the view descriptor), 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 row that was just retrieved. For updates, the engine issues UPDAT, ADDIT, and DELET commands for the data records. Typically, the SAS procedure then calls the engine again to retrieve another SAS row. If so, the engine locates another data record, constructs another SAS row, and returns it to the SAS procedure. This cycle continues until the SAS procedure terminates or until the last qualified SAS row has been constructed and returned to the SAS procedure.