iSeriesC file SHARE attribute

The file SHARE attribute has an effect on the behavior of EGL programs in the iSeriesC environment.

The following table shows program behavior for specific and general file operations depending on the iSeries® file SHARE attribute.

Table 1. Program behavior for the SHARE attribute
Subject SHARE(*YES) SHARE(*NO)
Record position within a file Record position is shared between programs. Record position is independent between programs.
close statement (implemented as COBOL CLOSE statement) Virtual or absolute depending on whether the file was already open when the program was started. Absolute CLOSE of a file. Record position is lost. (Poor performer)
First use of an EGL file I/O statement on each file (implemented in part as COBOL OPEN statement with INPUT, OUTPUT, or INPUT-OUTPUT phrases, depending on the use of other I/O statements for the same file in the program)
  • Must be done in each program that uses the file.
  • Run time hard error if the OPEN phrase is not compatible with the file open type of the program that actually opened the file. (If you are running in V6.0 compatibility mode and vgVar.handleHardIOErrors is 1, then program logic handles the error; if vgVar.handleHardIOErrors is not set to 1, then the program ends).
  • Must be done in each program that uses the file.
  • File OPEN phrases are independent in each program, so they do not have to conform to each other.
Anytime a program ends
  • For a main EGL run unit program, all files in the run unit are closed, but the effect is virtual or absolute depending on whether the file was already open when the program was started.
  • For a called EGL program, the file is kept open, and the record position is saved, if the program is restarted in the current EGL run unit.
  • Files within a library are left open until the main program terminates, which means you can perform file I/O within a single library, but called from many EGL sources, such as other libraries, main or called programs.
  • For a main EGL run unit program, all files in the run unit are closed, and the effect is absolute.
  • For an EGL library or called EGL program, the file is kept open, and the record position is saved, if the program is restarted in the current EGL run unit.

Feedback