Override with Save File (OVRSAVF)

The Override with Save File (OVRSAVF) command is used (1) to override or replace a file named in a program, (2) to override certain attributes of a file that are used by a program, or (3) to override the file named in a program and certain attributes of the overriding file.

This command does not apply to save and restore commands.

More information on overriding files is in the Files and file systems category in the IBM i Information Center at http://www.ibm.com/systems/i/infocenter/.

Note: Using this command does not cause a file to be overridden immediately. Information provided on this command is stored until the file is used, at which time the file is overridden.

Parameters

Keyword Description Choices Notes
FILE File being overridden Name Required, Positional 1
TOFILE Save file Single values: *FILE
Other values: Qualified object name
Optional, Positional 2
Qualifier 1: Save file Name
Qualifier 2: Library Name, *LIBL, *CURLIB
EXTEND Extend file *NO, *YES Optional
POSITION Starting position in file Single values: *START
Other values: Element list
Optional
Element 1: Retrieve order *RRN
Element 2: *RRN--Record number Unsigned integer
WAITFILE Maximum file wait time Integer, *IMMED, *CLS Optional
SECURE Secure from other overrides *NO, *YES Optional
OVRSCOPE Override scope *ACTGRPDFN, *CALLLVL, *JOB Optional
SHARE Share open data path *NO, *YES Optional
OPNSCOPE Open scope *ACTGRPDFN, *JOB Optional

File being overridden (FILE)

Specifies the save file in the using program to which this override command is applied. The specified file must be a save file when *FILE is specified in the Save file (TOFILE) parameter.

Note: The information in a save file has meaning only to Operating System/400 save and restore; redirecting another type of file to a save file or vice versa is not recommended.

This is a required parameter.

name
Specify the name of the save file.

Save file (TOFILE)

Specifies the save file that is used instead of the file specified on the File being overridden (FILE) parameter or, if *FILE is specified, specifies that certain attributes are overridden by parameters specified on this command. The parameters specified on this command override the other values specified in the save file or in the program.

Single values

*FILE
The save file named in the FILE parameter has certain parameters overridden by the values specified in this command.

Qualifier 1: Save file

name
Specify the name of the save file that is used instead of the overridden file name.

Qualifier 2: Library

*LIBL
All libraries in the library list for the current thread are searched until the first match is found.
*CURLIB
The current library for the job is used to locate the save file. If no library is specified as the current library for the job, QGPL is used.
name
Specify the library where the save file is located.

Extend file (EXTEND)

Specifies, for output operations only, whether new records are added to the end of the data currently in the save file. This option is used to start processing after an application or a system failure. When this operation is completed, the file must contain the image of a single save operation made by a save command, or it may not be possible to restore objects from the save file. This parameter overrides the extend value specified in the program. The sequencing information in the file's records guarantees that after a system failure, a record cannot be skipped or sent twice.

*NO
Records are not added to the end of the specified save file, but they replace existing records in the file. If the save file already contains records, an inquiry message is sent that clears the file or cancels the operation. If no value is specified for this parameter by the program or in an override, this is the default action assumed when the file is opened for output.
*YES
New records are added to the end of the records contained in the save file.

Starting position in file (POSITION)

Specifies the starting position for getting records from the save file. The first record to get is either at the beginning of the file (*START) or at a particular relative record number position in the file (*RRN). This parameter overrides the value specified in the program.

Single values

*START
Get the first record in the file first. If no value is specified for this parameter by the program, or in an override, this is the default action assumed when the file is opened for input.

Element 1: Retrieve order

*RRN
The relative record number specified for the second element of this parameter is the first record to get.

Element 2: *RRN--Record number

unsigned-integer
Specify the record number (its position from the beginning of the file) of the record that you get first.

Maximum file wait time (WAITFILE)

Specifies the number of seconds that the program waits for the file resources to be allocated when the file is opened, or the device or session resources to be allocated when an acquire operation is performed to the file. If the file resources cannot be allocated in the specified wait time, an error message is sent to the program.

*IMMED
The program does not wait. Immediate allocation of file resources is required.
*CLS
The default wait time specified in the class description is used as the wait time for the allocation of the file resources.
integer
Specify the number of seconds that the program waits for the file resources to be allocated. Valid values range from 1 through 32767.

Secure from other overrides (SECURE)

Specifies whether this file is protected from the effects of file override commands that were previously called.

*NO
This file is not protected from other file overrides; its value is overridden by the effects of any file override commands that were previously called.
*YES
This file is protected from the effects of any file override commands that were previously called.

Override scope (OVRSCOPE)

Specifies the extent of influence (scope) of the override.

*ACTGRPDFN
The scope of the override is determined by the activation group of the program that calls this command. When the activation group is the default activation group, the scope equals the call level of the calling program. When the activation group is not the default activation group, the scope equals the activation group of the calling program.
*CALLLVL
The scope of the override is determined by the current call level. All open operations done at a call level that is the same as or higher than the current call level are influenced by this override.
*JOB
The scope of the override is the job in which the override occurs.

Share open data path (SHARE)

Specifies whether the open data path (ODP) is shared with other programs in the same routing step. When an ODP is shared, the programs accessing the file share facilities such as the file status and the buffer.

*NO
The ODP is not shared with other programs in the routing step. A new ODP for the file is created and used every time a program opens the file.
*YES
The same ODP is shared with each program in the job that also specifies *YES when it opens the file.

Open scope (OPNSCOPE)

Specifies the extent of influence (scope) of the open operation.

*ACTGRPDFN
The scope of the open operation is determined by the activation group of the program that called the OVRSAVF command processing program. If the activation group is the default activation group, the scope is the call level of the caller. If the activation group is a non-default activation group, the scope is the activation group of the caller.
*JOB
The scope of the open operation is the job in which the open operation occurs.

Examples

OVRSAVF   FILE(ONLINE)  POSITION(*RRN 100)  SECURE(*YES)

This command overrides the file named ONLINE so that the first record gotten after the file is opened for input is relative record number 100. The file is also safe from overrides (in previous program calls).

Error messages

*ESCAPE Messages

CPF180C
Function &1 not allowed.
CPF1892
Function &1 not allowed.