Update Processing

Updating, Deleting, and Adding Data Records

Update processing involves updating, deleting, and adding data records. You must retrieve the data record before updating or deleting it.
Adding a new record requires additional processing after the record has been inserted. The position of the new record must be established so that the interface view engine can find and display it for interactive online updating. However, a procedure such as the APPEND procedure can avoid the additional processing time for repositioning. If the DDBLOAD= data set option is nonzero, such as DDBLOAD equals 1, the APPEND procedure loads the data from a SAS file into the CA-Datacom/DB table with an uninterrupted succession of ADDIT commands. Then you can use a SAS procedure, such as FSEDIT or PRINT, to view the new records.
For more information about the DDBLOAD option, see Data Set Options and System Options for the CA-Datacom/DB Interface.

Repositioning to an Inserted Record

If the Default Key is the Master Key and DUPE-MASTER-KEY is N, repositioning takes place efficiently. Without a WHERE clause, the RDULE command locks the record. The LOCKX command can locate the index entry just added. Subsequent commands move backward and forward, traversing the actual index.
With a WHERE clause, the interface view engine uses the Compound Boolean Selection (CBS) facility instead of directly traversing a permanent database index. After an ADD, the original Select File does not contain the new record. Therefore, it issues a LOCKX command, followed by an RDUID command, which enables the engine to keep an internal table of internal record ID numbers. You can return to the new records without reissuing the WHERE clause.
Repositioning is less efficient if the key value is not guaranteed to be unique. The interface view engine tries to retrieve the newly added record by issuing a SELFR command containing a WHERE clause that comprises all the values in the record just added. If more than one record qualifies, the last record is retrieved, which often is the last record that was added.
In conclusion, here are some external effects of adding new data records.
  • For better performance, use the DDBLOAD option to suppress the additional overhead of repositioning. If DDBLOAD equals 1 and there is no WHERE clause, the newly added records are accessible, but you are not repositioned to them when they are added to the table. However, you can find them without leaving the procedure.
    For DDBLOAD=1 and a WHERE clause, the new records are not accessible for viewing since they are not on the original Select File and you suppressed the overhead of keeping track of them. You must either reissue the WHERE clause or exit the procedure and call it again to see the new records.
  • If DDBLOAD equals 0 (the default), the engine takes the time to keep track of the new records for repositioning. With no WHERE clause, an entry is placed in the index for the Default Key and that becomes the new position. With a WHERE clause or the type of SORT clause that causes a Select File, the engine appends the new record ID at the end of the Select File (not in value order).
Note: Repositioning with a WHERE clause is similar to the Base SAS engine processing in which new rows are shown at the end of the SAS data file. On the other hand, repositioning without a WHERE clause reflects the CA-Datacom/DB processing in which new records are shown in Default Key order. (The record goes in the same place in the table with or without a WHERE clause. This discussion simply explains how it looks to SAS.)