30.06.2013 Views

File Management - IBM

File Management - IBM

File Management - IBM

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

can be used with the current open of the file; a new open data path does not have<br />

to be created. This reduces the amount of time that is required to open the file<br />

after the first opened to open the file after the first open, and the amount of main<br />

storage that is required by the job. You must specify SHARE(*YES) for the first<br />

open and other opens of the same file to share the open data path. A well-designed<br />

(for performance) application will normally do a shared open on database files that<br />

multiple programs will open in the same job. Specifying SHARE(*YES) for other<br />

files depends on the application.<br />

Shared files in the ILE model<br />

In the ILE model, shared files are scoped either to the job level or to the activation<br />

group level. An activation group is a substructure of a run-time job. It consists of<br />

system resources (storage for program or procedure variables, commitment<br />

definitions, and open files) that are allocated to one or more programs. An<br />

activation group is like a miniature job within a job.<br />

Any programs that run in any activation group can share shared files that are<br />

scoped to the job level. Only programs that run in the same activation group can<br />

share shared files that are scoped to the activation group level.<br />

Sharing files: considerations<br />

Sharing files allows you to have programs within a job interact in ways that would<br />

otherwise not be possible. However, you should read the following topics to learn<br />

more about the effects of opening, performing read and write operations, and<br />

closing shared files:<br />

v “Open considerations for files shared in a job”<br />

v “I/O considerations for files shared in a job” on page 14<br />

v “Close considerations for files shared in a job” on page 15<br />

You should also see the appropriate documentation for all of the file types to<br />

understand how this support works, and the rules your programs must follow to<br />

use it correctly.<br />

Note: Most high-level language programs process an open or a close operation<br />

independent of whether or not the file is being shared. You do not specify<br />

that the file is being shared in the high-level language program. You indicate<br />

that the file is being shared in the same job through the SHARE parameter.<br />

You specify the SHARE parameter only on the CREATE, CHANGE, and<br />

OVERRIDE file commands. Refer to your appropriate language information<br />

for more information.<br />

Open considerations for files shared in a job<br />

Consider the following points when you open a shared file in the same job by<br />

specifying SHARE(*YES).<br />

v You must make sure that when the shared file is opened for the first time in a<br />

job, all the open options that are needed for subsequent opens of the file are<br />

specified. If the open options specified for subsequent opens of a shared file do<br />

not match those specified for the first open of a shared file, an error message is<br />

sent to the program. (You can correct this by making changes to your program<br />

to remove any incompatible options.)<br />

Chapter 2. <strong>File</strong> processing 13

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!