File redirection

 

File redirection lets you use overrides to direct data input or output to a device of a different type; for example, to send data that was intended for a diskette to a printer instead.

This use of overrides requires somewhat more foresight than the override applications listed above, because the program must be able to accommodate the different characteristics of the two devices involved.

To override to a different type of file, use the override command for the new type of file. For example, if you are overriding a diskette file with a printer file, use the Override with Printer File (OVRPRTF) command.

This section applies to using an application program only. System code might or might not support file redirection. Refer to Effect of overrides on some commands for rules on how system code processes overrides.

You use the OVRDBF command to redirect a file to a distributed data management (DDM) file. If the remote system is another System i™ product, all normal rules discussed in this topic apply. If the remote system is not a System i or System/38™ product, then normally you should not specify an expiration date or end-of-file delay.

When you replace the file that is used in a program with another file of the same type, the new file is processed in the same manner as the original file. If you redirect a field-level file, or any other file that contains externally described data, you should typically specify LVLCHK(*NO) or recompile the program. Even when you turn level checking off, the record formats in the file must remain compatible with the records in the program. If the formats are not compatible, the results cannot be predicted.

Overrides that have a TOFILE parameter value other than *FILE remove any database member specifications that might be on overrides applied at higher call levels. The member name will default to *FIRST unless it is specified with the change to the file name or library or on another override at a lower call level.

If you change to a different type of file, the system ignores device-dependent characteristics and records that the system reads or writes sequentially. You must specify some device parameters in the new device file or the override. The system uses defaults for others.

The system ignores any attributes that are specified on overrides of a different file type than the final file type. The parameters SPOOL, SHARE, and SECURE are exceptions to this rule. The system accepts the parameters from any override that is applied to the file, regardless of device type.

 

Parent topic:

Overrides

 

Related concepts


Application of overrides

 

Related information


Distributed data management