CL Programming

Overriding Database Files in a CL Procedure or Program

You can use the Override with Database File (OVRDBF) command to replace the database file named in a CL procedure or program or to change certain parameters of the existing database file. This may be especially useful for files that have been renamed or moved since the procedure or program was created. It can also be used to access a file member other than the first member.

The initial parameters of the OVRDBF command are:

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

The OVRDBF command is valid for a file referred to by a CL procedure or program only if the file specified in the 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 OVRDBF command must be processed before the file to be overridden is opened for use (an open occurs by the first use of the RCVF command). The file is overridden if it is opened in the procedure or OPM program containing the 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).


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]