Files shared in a job

In order for your application program to use the open data path built by the Open Query File (OPNQRYF) command, your program must share the query file. If your program does not open the query file as shared, then it actually does a full open of the file it was originally compiled to use (not the query open data path built by the OPNQRYF command).

Your program will share the query open data path, depending on the following conditions:
The OPNQRYF command never shares an existing open data path in the job or activation group. A request to open a query file fails with an error message if the open data path has the same library, file, and member name that is in the open request, and if either of the following is true:

Subsequent shared opens adhere to the same open options (such as SEQONLY) that were in effect when the OPNQRYF command was run.

Related concepts
Share database files in the same job or activation group