Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
Using KSAM XL and KSAM 64: 900 Series HP 3000 Computer Systems > Chapter 5 Reading File Data

Shared File Access

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Index

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.

NOTE: File locking keeps the file inaccessible to other users until the file is unlocked. This could be a potential source of performance problems. A different file structure may be more suitable for applications in a shared environment, such as IMAGE/3000, etc.

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.

FLOCK 
FFINDBYKEY (sets the logical pointer)
FREAD loop (reads records in key sequence)
FUNLOCK
Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© Hewlett-Packard Development Company, L.P.