IBM AS/400 Frozen Dessert Maker User Manual


 
Sharing an Open Data Path
included. These output operations can be processed by EXCEPT output, detail
output, or total output.
(There are exceptions to these rules when operating under commitment control.
See “Using Commitment Control” on page 307 for more information.)
Sharing an Open Data Path
An open data path is the path through which all input and output operations for a
file are performed. Usually a separate open data path is defined each time a file is
opened. If you specify SHARE(*YES) for the file creation or on an override, the first
program’s open data path for the file is shared by subsequent programs that open
the file concurrently.
The position of the current record is kept in the open data path for all programs
using the file. If you read a record in one program and then read a record in a
called program, the record retrieved by the second read depends on whether the
open data path is shared. If the open data path is shared, the position of the
current record in the called program is determined by the current position in the
calling program. If the open data path is not shared, each program has an inde-
pendent position for the current record.
If your program holds a record lock in a shared file and then calls a second
program that reads the shared file for update, you can release the first program's
lock by :
performing a READ operation on the update file by the second program, or
using the UNLOCK or the read-no-lock operations.
In ILE, shared files are scoped to either the job level or the activation group level.
Shared files that are scoped to the job level can be shared by any programs
running in
any
activation group within the job. Shared files that are scoped to the
activation group level can be shared
only
by the programs running in the same
activation group.
The default scope for shared files is the activation group. For job-level scope,
specify OVRSCOPE(*JOB) on the override command.
ILE RPG offers several enhancements in the area of shared ODPs. If a program or
procedure performs a read operation, another program or procedure can update the
record as long as SHARE(*YES) is specified for the file in question. In addition,
when using multiple-device files, if one program acquires a device, any other
program sharing the ODP can also use the acquired device. It is up to the pro-
grammer to ensure that all data required to perform the update is available to the
called program.
Sharing an open data path improves performance because the OS/400 system
does not have to create a new open data path. However, sharing an open data
path can cause problems. For example, an error is signaled in the following cases:
If a program sharing an open data path attempts file operations other than
those specified by the first open (for example, attempting input operations
although the first open specified only output operations)
Chapter 15. General File Considerations 277