HP RPG/XL Programmer's Guide (30318-90001)

3- 25
Figure 3-20. Automatically Locking and Unlocking KSAM Files
Comments
1 This line defines KSAM file, MASTFL, as an Update CHAINed file.
2 This line enables the automatic lock facility for MASTFL.
Column 53 is K to indicate that this is a Continuation line.
Columns 54-59 are LOCK to enable RPG automatic locking.
3 The line reads MASTFL randomly by department number, DEPT.
4 This line directs RPG to perform exception output when a
department record is not found (indicator 80 is turned on).
5 This line defines the MASTFL file output record for new (added)
records.
Manually Locking and Unlocking Shared KSAM Files. Using NOLOCK in the
File Description Continuation Specification lets you manually lock and
unlock a KSAM file yourself.
Figure 3-21 shows how to enter the File Description and Calculation
Specifications that lock and unlock a KSAM file. The purpose of the
program is to add records to the file. Before they are added, the
program checks to see if they already exist. The KSAM file is locked
before the check is made and unlocked after the new record is added.
When manually locking and unlocking a KSAM file, you must enter a file
equation similar to the following before running the program:
:FILE MASTFL;SHR