Format 1 (Sequential Files) *--------------------------------------------* + *------------------------------* + V V + + ->->---OPEN-*-INPUT---file-name-1-*------------------*---*----><- + *--REVERSED--------* + + *-*----*NO REWIND--* + + *WITH* + + *------------------------------* + + V + + *-OUTPUT---file-name-2-*------------------*--* + *-*----*NO REWIND--* + + *WITH* + + *-----------* + + V + + *-I-O---file-name-3-*------------------------* + *-----------* + + V + + *-EXTEND---file-name-4-*---------------------*
The INPUT phrase permits opening the file for input operations. The file position indicator is set to the first record in the file. If no records exist in the file, the file position indicator is set so that processing of the first sequential READ statement results in an AT END condition.
File-name-1, file-name-2, file-name-3, and file-name-4, each designate a file upon which OPEN is to operate. If you specify more than one file, the files do not need to have the same organization or access. Each file-name must be defined in an FD entry in the Data Division, and must not name a sort or merge file. The FD entry must be equivalent to the information supplied when the file was defined.
When you specify REVERSED, the OPEN operation positions the sequential tapefile at the last record in the file. When you read from an input file that is REVERSED, data records are read sequentially from the last record to the first record.
You can use the REVERSED phrase only for sequential tapefiles opened in input mode.
The REVERSED phrase is an obsolete element and will be deleted from the next revision of the ANSI Standard.
Normally, the OPEN statement for a tapefile repositions the file so that it is read or written from the beginning. The NO REWIND phrase indicates that the OPEN operation will not reposition the tapefile.
The system keeps track of the current position on the tape and automatically positions the tape to the proper place. When you process a multifile tape volume, specify the NO REWIND phrase on all CLOSE statements. When the next file on the volume is opened, the system determines which direction the tape should be moved to most efficiently get to the desired file.
You can use the NO REWIND phrase for sequential tapefiles opened in input mode or output mode.
When you specify the OUTPUT phrase, the file is opened to allow only output operations. When the file is successfully opened, it contains no records.
If you open a physical file in output mode, all of the records in the file are cleared.
If you open a logical file for OUTPUT, no records are cleared. The file is treated as though you had specified the EXTEND phrase. To clear a logical file, you must clear all of the members on which the logical file is based.
When you specify the I-O phrase, the file is opened to allow both input and output operations. The file position indicator is set to the first record in the file. If no records exist in the file, the file position indicator is set so that processing of the first sequential READ statement results in an AT END condition.
When you specify the EXTEND phrase, the sequential file is opened to allow you to add records immediately following the last record in the file.
When you create a sequential file, you can open the file in extend mode.
The EXTEND phrase is not allowed for files for which the LINAGE clause has been specified.
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.