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

3-: 26
Figure 3-21. Manually Locking and Unlocking KSAM Files
Comments
1 This line defines the KSAM file,MASTFL, as an Update CHAINed
file.
2 This line enables the manual locking facility for the file,
MASTFL.
Column 53 is K to indicate that this is a Continuation line.
Columns 54-59 are NOLOCK to enable RPG manual locking.
3 This line locks the file, MASTFL, before a record is read from
it.
Columns 28-32 contain LOCK. This locks MASTFL before the chain
operation (next line).
Columns 33-42 contain the name of the KSAM file, MASTFL.
Columns 58-59 contain 12 to turn on indicator 12 when the lock
operation is successful.
4 This line reads MASTFL in a chained fashion.
Columns 10-11 contain 12 to execute the CHAIN operation when
resulting indicator 12 is turned on (the previous LOCK operation
was successful).
5 This line performs exception output when a department record is
not found (indicator 80 is turned on).
6 This line unlocks the file, MASTFL.
7 This line defines the MASTFL file output record for new (added)
records.