Overriding files with different file types
If you change to a different type of file, the system ignores the device-dependent characteristics and reads or writes the records sequentially.
The program must specify some device parameters in the new device file or the override. The system takes default parameters for others. This manual describes the effect of specific redirection combinations later in this section.
The system ignores any attributes specified on overrides of a different file type than the final file type. The parameters SPOOL, SHARE, OPNSCOPE, and SECURE are exceptions to this rule. The system accepts the above parameters from any override to the file, regardless of device type.
Some redirection combinations present special problems due to the specific characteristics of the device. In particular:
- Do not use file redirection for save files.
- You can redirect nonsequentially processed database files only to another database file or a DDM file.
- You can redirect display files and ICF files that use multiple devices (MAXDEV or MAXPGMDEV > 1) only to a display file or an ICF file.
- Redirecting a display file to any other file type, or another file type to a display file, requires:
This is necessary because the display file omits these unused fields from the record buffer, but other file types do not.
- That the program be recompiled, with the override active, if there are any input-only or output only fields.
Table 1 summarizes valid file redirections.
Table 1. File redirections To-file From-file Printer ICF Diskette Display Database Tape Printer O* O O O O O ICF I/O I/O O O O O O O I I I I I Diskette O O O O O O I I I I I Display I/O I/O O O O O O O I I I I I Database O O O O O O I I I I I Tape O O O O O O I I I I I
- I=input file O=output file I/O=input/output file
- *=redirection to a different type of printer
To use Table 1, identify the file type to override in the FROM-FILE columns and the file type to override in the TO-FILE column. The intersection specifies an I or O or both, meaning that the substitution is valid for these two file types when used as input files or as output files.
For instance, you can override a diskette output file with a tape output file, and a diskette input file with a tape input file. The chart refers to file type substitutions only. That is, you cannot change the program function by overriding an input file with an output file.
The following charts describe the specific defaults taken andwhat to ignore for each redirection combination.
- From:
- Diskette Input
- To:
- ICF: Records are retrieved from the ICF file one at a time.
Display: Records are retrieved from the display one at a time. Type in the data for each record and press the Enter key when the record is complete. A nonfield-level device file must be specified. Diskette label information is ignored.
Database: Records are retrieved in sequential order. Diskette label information is ignored.
Tape: Records are retrieved in sequential order. If a label value is specified in the program, that value is used as the label for the tape file.
- From:
- Diskette output
- To:
- ICF: Records are written to the ICF file one at a time.
Database: Records are written to the database in sequential order.
Display: Records are written to the display with each record overlaying the previous record. You can request each output record using the Enter key.
Printer: Records are printed and folding or truncating is performed as specified in the printer file.
Tape: Records are written on tape in sequential order.
- From:
- Tape input
- To:
- ICF: Records are retrieved from the ICF file one at a time.
Display: Records are retrieved from the display one at a time. Type in the data for each record and press the Enter key when the record is complete. A nonfield-level device file must be specified. Tape label information is ignored.
Database: Records are retrieved in sequential order. One record is read as a single field. Tape label information is ignored.
Diskette: Records are retrieved in sequential order. If a label value is specified in the program, that value is used as the label for the diskette file.
- From:
- Tape Output
- To:
- Printer: Records are printed, and folding or truncating is performed as specified in the printer file.
ICF: Records are written to the ICF file one at a time. Tape label information is ignored.
Diskette: The amount of data written on diskette depends on the exchange type of the diskette. If a label value is specified in the program, that value is used as the label for the diskette file.
Display: Records are written to the display with each record overlaying the previous record. You can request each output record using the Enter key.
Database: Records are written to the database in sequential order.
Parent topic:
File redirection