|
|
Using KSAM XL: 900 Series HP 3000 Computer Systems > Chapter 5 Reading File DataShared File Access |
|
If only one process is accessing a file, setting a pointer and reading a record in a two-step process does not present a problem. Shared file access, however, presents potential retrieval contention. If a pointer is positioned to retrieve a particular record by one process, another process could modify or delete the record before the original process reads it. The FLOCK and FUNLOCK intrinsics should be used to ensure proper record retrieval in any program that allows shared access to its file.
An FLOCK intrinsic call should be made prior to a pointer positioning and record reading procedure to ensure that the proper retrieval is executed. The FUNLOCK intrinsic restores shared access once the retrieval is completed. Once the file is unlocked, do not assume that the pointer is still valid. Before using the pointer again, reposition it. The following sequence shows the appropriate locking procedure to ensure the proper sequence of records.
|
|