Overriding database files in a CL procedure or program (OVRDBF command)

The Override with Database File (OVRDBF) command overrides the database file named in a CL procedure or program, or changes certain parameters of the existing database file.

This can be especially useful for files that have been renamed or moved since the procedure or program is created. It can also be used to access a file member other than the first member.

The initial parameters of the OVRDBF command are as follows:

OVRDBF FILE(overridden-file-name) TOFILE(new-file-name)
       MBR(member-name)

The Override with Database File (OVRDBF) command is valid for a file referred to by a CL procedure or program only if the file specified in the Declare File (DCLF) command was a database file when the module or program was created. The file used when the program was processed must be of the same type as the file referred to when the module or program was created.

The Override with Database File (OVRDBF) command must be processed before the file to be overridden is opened for use (an open occurs by the first use of the Receive File (RCVF) command). The file is overridden if it is opened in the procedure or original program model (OPM) program containing the Override with Database File (OVRDBF) command, or if it is opened in another program to which control is transferred by the CALL command, or if it is opened in another procedure to which control is transferred using the CALLPRC command.

When you override to a different file, the overriding file must have only one record format. A logical file which has multiple record formats defined in DDS may be used if it is defined over only one physical file member. A logical file which has only one record format defined in the DDS may be defined over more than one physical file member. The name of the format does not have to be the same as the format name referred to when the program was created. You should ensure that the format of the data in the overriding file is the same as in the original file. You may get unexpected results if you specify LVLCHK(*NO).