![]() |
| OVRDBF and DLTOVR commands in CL |
Introduction to override commands
We can override either a database file or a DSPF or PRTF file. command used to override display file (DSPF) is OVRDSPF and for printer file (PRTF) its OVRPRTF and that will be covered in a separate article. Here, in this article we will discuss about OVRDBF command to override a database file. override means replace so basically OVRDBF command is used to override i.e. replace the file in the program or override certain parameters of a file that are used by the program or both. This command applies to PF, LF and DDM files.
To override a file named/defined in the program we need to provide that file named in program in FILE parameter and the actual file to be processed in the program in the TOFILE parameter.
To override only certain parameters of the file named/defined in the program we need to pass named file in the program in FILE parameter and *FILE value in TOFILE parameter the use other parameters of the OVRDBF command to override specific paramters of the file.
Some important parameters of the OVRDBF command
Why does override happen in the database?
Examples
Let's dicsuss some examples to better understand the OVRDBF command.
Example 1: Overriding a file from another library
Currently the file is in current library EASYCLASS1 and we want to use file in library EASYCLASS2.
CLPF1 *FILE EASYCLASS1 PF Read PF in CL program
Use the OVRDBF command with below parameters to overrride file CLPF1 present in library EASYCLASS2.
Override with Data Base File (OVRDBF)
Type choices, press Enter.
File being overridden . . . . . FILE CLPF1
Overriding to data base file . . TOFILE CLPF1
Library . . . . . . . . . . . EASYCLASS2
Overriding member . . . . . . . MBR
Starting position in file: POSITION
Retrieve order . . . . . . . .
*RRN-rcd nbr *KEY-nbr key flds
*KEY-rec format having key . .
*KEY-key value . . . . . . . .
Example 2: Overriding an existing member
OVRDBF FILE(CLPF1) MBR(MBR2)
The above command will override the member MBR2 instead of the first member and therefore MBR2 will get processed in the program instead of first member of file CLPF1.
Example 3: Overriding a share specification
OVRDBF FILE(CLPF1) SHARE(*YES)
Any open of this file will use the ODP(open data path) for the file.
Example 4: Overriding a file
OVRDBF FILE(INPUT) TOFILE(CLPF1)
The file CLPF1 will be processed instead of file named INPUT.
How to Delete Overrides?
Parameters of DLTOVR command
Example 1: Delete Override for one or more file
DLTOVR FILE(FILE1 FILE2)
Example 2: Delete Override for all the file
DLTOVR FILE(*ALL)
