IBM AS/400 Manuel D’Utilisation

Page de 489
 
 
File Locking
 
RPG program
Execution Time:
No Override
File name = QTAPE
Format = E
Device = SEQ
Compile Time:
Override File
QTAPE to
File FMT1
QTAPE
FMT1
File type =
DEVICE
Device type =
TAPE
Figure  137.  Redirecting File Input and Output Example
 File Locking
The OS/400 system allows a lock state (exclusive, exclusive allow read, shared for
update, shared no update, or shared for read) to be placed on a file used during
the execution of a job. Programs within a job are not affected by file lock states. A
file lock state applies only when a program in another job tries to use the file con-
currently. The file lock state can be allocated with the CL command ALCOBJ (Allo-
cate Object). For more information on allocating resources and lock states, see the
Data Management manual.
The OS/400 system places the following lock states on database files when it
opens the files:
The shared-for-read lock state allows another user to open the file with a lock state
of shared for read, shared for update, shared no update, or exclusive allow read,
but the user cannot specify the exclusive use of the file. The shared-for-update lock
state allows another user to open the file with shared-for-read or shared-for-update
lock state.
The RPG program places an exclusive-allow-read lock state on device files.
Another user can open the file with a shared-for-read lock state.
The lock state placed on the file by the RPG program can be changed if you use
the Allocate Object command.
File Type
Lock State
Input
Shared for read
Update
Shared for update
Add
Shared for update
Output
Shared for update
   
Chapter 15. General File Considerations
275