Progress/400
Product Guide


Record Locking

The Progress RDBMS supports three lock states at the record level: EXCLUSIVE-LOCK, SHARE-LOCK, and NO-LOCK. The Progress/400 DataServer supports either these three lock states or, if you choose, the standard DB2/400 lock states LOCK and NO-LOCK. This section describes how to implement either form of record locking at the dictionary library level.

Standard Progress Locks

To support the standard Progress locking technique, the Progress/400 DataServer accesses a Progress lock table object on the AS/400. If the lock table is not present, Progress locking behavior is not supported. The lock table locks records for the physical files that are defined as part of the Progress/400 server schema. It ensures that DB2/400 records accessed by Progress applications are locked in the same manner as records on other Progress platforms.

However, the lock table applies only for Progress 4GL applications. Non-Progress languages (for example, RPG) accessing a Progress/400 dictionary library use the IBM locks LOCK and NO-LOCK. The DataServer issues a DB2/400 lock when it issues a Progress EXCLUSIVE-LOCK. Therefore, the Progress/400 lock table does not ensure that records are locked against access by non-Progress applications.

See the "Additional Locking Considerations" section for information about factors that affect record locks in DB2/400. See the chapter on transactions in the Progress Programming Handbook for more information on Progress locks.

Creating and Maintaining the Progress/400 Lock Table

The Progress/400 lock table is an OS/400 object of the *USRSPC type with the LOCK attribute. Its name is PROLKT.

The lock table has an initial default value of 500 lock table entries. A lock table entry is required for each currently locked record and for each user (transaction) that is waiting for a locked record (both EXCLUSIVE-LOCK and SHARE-LOCK).

In a Progress database, the lock table exists only during an active Progress session; the Progress/400 lock table object exists until you explicitly delete it, whether or not there is an active Progress session. You are restricted to one lock table per Progress/400 server schema.

To create or modify a lock table, use the Progress/400 Create Lock Table (CRTPROLKT) utility. Use this OS/400 syntax to create a lock table or to change the number of lock table entries:

CRTPROLKT PRODCT(library-name) NUMLCK(number) 

Table 2–6 describes the CRTPROLKT parameters.

Table 2–6: CRTPROLKT Parameters 
Parameter
Keyword
View
Progress/400 Dictionary Name
PRODCT
Enter the name of the OS/400 Data Dictionary library where you want the lock table to reside.
Number of
lock table entries
NUMLCK
Enter the maximum number of entries that the lock table will support. This number includes both the records that are currently locked and records that are waiting for a record that is locked. The default is 500. The maximum value is 99999.

You can also create a lock table when you run the DUPPRODB utility. Enter *YES for the Create Progress Lock Table parameter. To delete the lock table, delete the OS/400 *USRSPC object.

Standard DB2/400 Locks

Locking on the AS/400 is handled by the DB2/400 record management system. The DB2/400 record management system views a record as having a LOCK or a NO-LOCK. If you use standard DB2/400 locks with Progress applications, an EXCLUSIVE-LOCK is implemented as a DB2/400 LOCK, and SHARE-LOCK and NO-LOCK are implemented as DB2/400 NO-LOCK.

SHARE-LOCK Implications

When you implement standard DB2/400 locks instead of standard Progress locks, you might encounter problems with applications that depend on Progress SHARE-LOCKs. For example, if the program PGM-A has a record under EXCLUSIVE-LOCK, and the program PGM-B requests the same record (SHARE-LOCK), the Progress/400 DataServer allows PGM-B access to the record. You will have a problem if PGM-A updates the record and releases the lock, and PGM-B then updates the record based on the old data. To resolve this problem, explicitly specify EXCLUSIVE-LOCK when you read records for update.

Additional Locking Considerations

This section lists additional considerations about OS/400 locking:


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095