Use Open Database File (OPNDBF) command

Usually, when you use the Open Database File (OPNDBF) command, you use the defaults for the command parameter values. Sometimes you might want to specify particular values, instead of using the default values. Listed here are the parameters you can specify.

ACCPTH parameter

If the file has a keyed sequence access path and either (1) the open option is *OUT, or (2) the open option is *INP or *ALL, but your program does not use the keyed sequence access path, then you can specify ACCPTH(*ARRIVAL) on the OPNDBF parameter. Ignoring the keyed sequence access path can improve your job's performance.

COMMIT parameter

Specify *YES if the application programs use commitment control. If you specify *YES, you must be running in a commitment control environment (the Start Commitment Control (STRCMTCTL) command was processed) or the OPNDBF command will fail. Use the default of *NO if the application programs do not use commitment control.

DUPKEYCHK parameter

Specify whether you want duplicate key feedback. If you specify *YES, duplicate key feedback is returned on I/O operations. If you specify *NO, duplicate key feedback is not returned on I/O operations. Use the default (*NO) if the application programs are not written in the COBOL/400® language or C/400® language, or if your COBOL or C programs do not use the duplicate-key feedback information that is returned.

MBR parameter

If a member, other than the first member in the file, is to be opened, you must specify the name of the member to be opened or issue an Override with Database File (OVRDBF) command before the OPNDBF command.
Note: You must specify a member name on the OVRDBF command to use a member (other than the first member) to open in subsequent programs.

OPNID parameter

If an identifier other than the file name is to be used, you must specify it. The open identifier can be used in other control language (CL) commands to process the file. For example, the Close File (CLOF) command uses the identifier to specify which file is to be closed.

OPNSCOPE parameter

This parameter specifies the scoping of the open data path (ODP). Specify *ACTGRPDFN if the request is from the default activation group, and the ODP is to be scoped to the call level of the program issuing the command. If the request is from any other activation group, the ODP is scoped to that activation group. Specify *ACTGRP if the ODP is to be scoped to the activation group of the program issuing the command. Specify *JOB if the ODP is to be scoped to the job. If you specify this parameter and the TYPE parameter you get an error message.

OPTION parameter

Specify the *INP option if your application programs use input-only processing (reading records without updating records). This allows the system to read records without trying to lock each one for possible update. Specify the *OUT option if your application programs use output-only processing (writing records into a file but not reading or updating existing records).
Note: If your program does direct output operations to active records (updating by relative record number), *ALL must be specified instead of *OUT. If your program does direct output operations to deleted records only, *OUT must be specified.

SEQONLY parameter

Specify *YES if subsequent application programs process the file sequentially. This parameter can also be used to specify the number of records that should be transferred between the system data buffers and the program data buffers. SEQONLY(*YES) is not allowed unless OPTION(*INP) or OPTION(*OUT) is also specified on the Open Database File (OPNDBF) command. Sequential-only processing should not be used with a keyed sequence access path file unless the physical data is in access path order.

TYPE parameter

Specify what you want to happen when exceptions that are not monitored occur in your application program. If you specify *NORMAL, one of the following operations can happen:
  • Your program can issue a Reclaim Resources (RCLRSC) command to close the files opened at a higher level in the call stack than the program issuing the RCLRSC command.
  • The high-level language you are using can perform a close operation.
Specify *PERM if you want to continue the application without opening the files again. TYPE(*NORMAL) causes files to be closed if both of the following situations occur:
  • Your program receives an error message.
  • The files are opened at a higher level in the call stack.
TYPE(*PERM) allows the files to remain open even if an error message is received. Do not specify this parameter if you specified the OPNSCOPE parameter.