Listed here are the commonly used database functions and the types of locks they place on database files.
Table 1 summarizes some of the most commonly used database functions and the types of locks they place on database files. The types of locks are explained on the next page.
Function | Command | File Lock | Member/Data Lock | Access Path Lock |
---|---|---|---|---|
Add Member | ADDPFM, ADDLFM | *EXCLRD | *EXCLRD | |
Change File Attributes | CHGPF, CHGLF | *EXCL | *EXCLRD | *EXCLRD |
Change Member Attributes | CHGPFM, CHGLFM | *SHRRD | *EXCLRD | |
Change Object Owner | CHGOBJOWN | *EXCL | ||
Check Object | CHKOBJ | *SHRNUPD | ||
Clear Physical File Member | CLRPFM | *SHRRD | *EXCLRD3 | |
Create Duplicate Object | CRTDUPOBJ | *EXCL (new object) *SHRNUPD (object) | ||
Create File | CRTPF, CRTLF, CRTSRCPF | *EXCL | ||
Delete File | DLTF | *EXCL | *EXCLRD | |
Grant/Revoke Authority | GRTOBJAUT, RVKOBJAUT | *EXCL | ||
Initialize Physical File Member | INZPFM | *SHRRD | *EXCLRD | |
Move Object | MOVOBJ | *EXCL | ||
Open File | OPNDBF, OPNQRYF | *SHRRD | *SHRRD | *EXCLRD |
Rebuild Access Path | EDTRBDAP, OPNDBF | *SHRRD | *SHRRD | *EXCLRD |
Remove Member | RMVM | *EXCLRD | *EXCL | *EXCLRD |
Rename File | RNMOBJ | *EXCL | *EXCL | *EXCL |
Rename Member | RNMM | *EXCLRD | *EXCL | *EXCL |
Reorganize Physical File Member | RGZPFM | *SHRRD | *EXCL4 | |
Restore File | RSTLIB, RSTOBJ | *EXCL | ||
Save File | SAVLIB, SAVOBJ, SAVCHGOBJ | *SHRNUPD1 | *SHRNUPD2 | |
1 For save-while-active, the file lock is *SHRUPD initially, and then the lock is reduced to *SHRRD. See the Backup and Recovery for a description of save-while-active locks for the save commands. 2 For save-while-active, the member/data lock is *SHRRD. 3 The clear operation does not happen if the member is open in this process or in any other process. 4 If ALWCANCEL(*YES) is specified, the LOCK keyword can specify a *SHRUPD or *EXCLRD lock instead. |
The following table shows the valid lock combinations:
|
Table 2 shows database locking for constraints of a database file, depending on whether the constraint is associated with the parent file (PAR) or the dependent file (DEP).
Type of function | File type | File5 | Member5 | Other file | Other member |
---|---|---|---|---|---|
ADDPFM1 | DEP | *EXCL | *EXCL | *EXCL | *EXCL |
ADDPFM1 | PAR | *EXCL | *EXCL | *EXCL | *EXCL |
ADDPFCST7 | *REFCST | *EXCL | *EXCL | *EXCL | *EXCL |
ADDPFCST6 | *UNQCST *PRIKEY | *EXCL | *EXCL | *EXCL | *EXCL |
ADDPFCST | *UNIQUE *PRIKEY | *EXCL | *EXCL | ||
RMVM2 | DEP | *EXCL | *EXCL | *EXCL | *EXCL |
RMVM2 | PAR | *EXCL | *EXCL | *EXCL | *EXCL |
DLTF3 | DEP | *EXCL | *EXCL | *EXCL | *EXCL |
DLTF3 | PAR | *EXCL | *EXCL | *EXCL | *EXCL |
RMVPFCST7 | *REFCST | *EXCL | *EXCL | *EXCL4 | *EXCL |
RMVPFCST6 | *UNQCST *PRIKEY | *EXCL | *EXCL | *EXCL | *EXCL |
RMVPFCST | *UNIQUE *PRIKEY | *EXCL | *EXCL | ||
CHGPFCST | *EXCL | *EXCL | *SHRRD | *EXCL | |
1 If adding a physical file member causes a referential constraint to be established. 2 If removing a physical file member causes an established referential constraint to become defined. 3 When deleting a dependent or parent file that has constraints established or defined for the file. 4 When the Remove Physical File Constraint (RMVPFCST) command is invoked for the parent file which has constraints established or defined, the parent and any logical files over the parent file are all locked *EXCL. 5 For referential constraints, the column refers to the dependent file or the dependent member. 6 Unique constraint or primary key constraint is a parent key in a referential constraint where the other file is a dependent file. 7 The other file is a parent file. |