Share database files in the same job or activation group

By default, the database management system lets one file be read and changed by many users at the same time. However, you can share the database files in the same job or activation group through the SHARE parameter.

You can share a file in the same job or activation group by opening the database file:
Note: For more information about open sharing in the Integrated Language Environment®, see the ILE ConceptsLink to PDF book.

The SHARE parameter on the create file, change file, and override database file commands allow sharing in a job or activation group, including sharing the file, its status, its positions, and its storage area. Sharing files in the job or activation group can improve performance by reducing the amount of main storage needed and by reducing the time needed to open and close the file.

Using the SHARE(*YES) parameter lets two or more programs running in the same job or activation group share an open data path (ODP). An open data path is the path through which all input/output operations for the file are performed. In a sense, it connects the program to a file. If you do not specify the SHARE(*YES) parameter, a new open data path is created every time a file is opened. If an active file is opened more than once in the same job or activation group, you can use the active ODP for the file with the current open of the file. You do not have to create a new open data path.

This reduces the amount of time required to open the file after the first open, and the amount of main storage required by the job or activation group. SHARE(*YES) must be specified for the first open and other opens of the same file for the ODP to be shared. A well-designed (for performance) application normally shares an ODP with files that are opened in multiple programs in the same job or activation group.

Specifying SHARE(*NO) tells the system not to share the ODP for a file. Normally, this is specified only for those files that are seldom used or require unique processing in specific programs.
Note: A high-level language program processes an open or a close operation as if the file were not being shared. You do not specify that the file is being shared in the high-level language program. You indicate that the file is being shared in the same job or activation group through the SHARE parameter. The SHARE parameter is specified only on the create, change, and override database file commands.