Specify the type of processing

When you use a file in a program, the system needs to know what type of operation you plan to use for that file. You can specify the type of processing with the OPTION parameter.

For example, the system needs to know if you plan to just read data in the file or if you plan to read and update the data. The valid operation options are: input, output, update, and delete. The system determines the options you are using from the information you specify in your high-level language program or from the OPTION parameter on the Open Database File (OPNDBF) and Open Query File (OPNQRYF) commands.

The system uses the options to determine which operations are allowed in your program. For example, if you open a file for input only and your program tries an output operation, your program receives an error.

Normally, the system verifies that you have the required data authority when you do an input/output operation in your program. However, when you use the OPNQRYF or OPNDBF command, the system verifies at the time the file is opened that you have the required data authority to perform the operations specified on the OPTION parameter.

The system also uses these options to determine the locks to use to protect the data integrity of the files and records being processed by your program.

Related concepts
Types of data authority
Lock shared data