Occasionally, the interface view engine also uses RDULE and REDLE (locking
and not locking) commands, which provide direct
addressability. Also, the LOCKG, LOCKL, and LOCNX commands are required when the engine
must recover from a situation where another user has deleted a data record that the
current user wants to view.
All retrieval commands
return an internal record ID (RID). CA-Datacom/DB sends the RID to the interface view engine. A SAS procedure can request the RID
from the engine even though it is internal and not a row number. The engine uses
most of the request
area for the RID (approximately 256 bytes), not just the internal seven-byte record-ID.
Commands such as REDLE and RDULE can use the retained RID information in a rebuilt
request area to reestablish the previous position in the index. Thus, after a record
is retrieved, its RID can be used to retrieve the record again.
Here is how the FSVIEW procedure uses the RID. For a large table, PROC FSVIEW might
need to display several screens of data. FSVIEW asks the engine for the RID for each
data record that it retrieves and saves the RID. If FSVIEW needs
to redisplay the window, it asks the engine to reposition using the specifically saved
RID. Once the position is reestablished, FSVIEW can ask the engine to traverse forward
or backward to retrieve the records that are needed to fill up the window again.
For example, suppose
you are using the FSVIEW procedure to look at a
CA-Datacom/DB table. If you issue the FORWARD command, the engine moves through the entire table
and displays the last screen of data. For each new
display, FSVIEW notes the RID of the record being displayed at the top of the screen.
If you issue the BACKWARD command to back up a screen, FSVIEW simply asks the engine
to point to the RID of the previous screen, rather than reading the table backward
sequentially. The engine issues a RELES command to drop the previous lock, and then
issues an RDULE command and reads forward one record at a time until it has redisplayed
that screen of data.
If the data record pointed to has been deleted (perhaps by another user), the REDLE/RDULE
command fails. In this situation, FSVIEW asks the engine to go forward to the next
undeleted data record. Since the engine has saved the
RID of the deleted record, it can go forward even though the record itself was deleted.
The LOCKG command enables the interface view engine to position on the first index
entry that has the proper key value. Then the engine can move forward with the LOCNX
command until it receives an entry with the same
key value but a higher internal record-ID or an entry with a higher value than the
one requested. The LOCKL command skips backward from a deleted record if the SAS
procedure requests it.