Subsequent READ statements for the file make the data records of the file available in reverse order; that is, starting with the last record. It is ignored when not applicable to the storage medium of the file. At that time, the associated file contains no data records. The I—O phrase permits the opening of a mass storage file for both input and output operations.
When sequential or relative files are opened with the I—O phrase, the file position indicator is set to 1. When indexed files are opened with the I—O phrase, the file position indicator is set to the characters that have the lowest ordinal position in the collating sequence associated with the file, and the prime record key is established as the key of reference.
In mode, if the run unit does not have write access to the file, the execution of an OPEN statement with the I—O phrase is unsuccessful and the I—O status value is set to indicate this condition. The last record for a relative file is the currently existing record with the highest relative record number. The last record for an indexed file is the currently existing record with the highest prime key value according to the collating sequence of the file.
The phrase is ignored if it does not apply to the storage medium on which the file resides. Cobol Interview Questions. Cobol Practice Tests. IT Skills. Management Skills. Communication Skills. Business Skills. Digital Marketing Skills. On Mainframes server, we do not use text files; instead we use PS files. Let's assume that the file present on Mainframes have same content as input. Write verb is used to insert records in a file. Once the record is written, it is no longer available in the record buffer.
Before inserting records into the file, move the values into the record buffer and then perform write verb. Write statement can be used with FROM option to directly write records from the working storage variables. From is an optional clause. If the access mode is sequential, then to write a record, the file must open in Output mode or Extend mode.
If the access mode is random or dynamic, then to write a record, the file must open in Output mode or I-O mode. Rewrite verb is used to update the records. File should be opened in I-O mode for rewrite operations. It can be used only after a successful Read operation. Rewrite verb overwrites the last record read. Delete verb can be performed only on indexed and relative files. The file must be opened in I-O mode.
In sequential file organization, records cannot be deleted. The record last read by the Read statement is deleted in case of sequential access mode. In random access mode, specify the record key and then perform the Delete operation. Here in this program, we have assigned a few variables with different values and later manipulated the output using different data file handling properties to clarify the different concepts related to DELETE property of files. Join YouTube Channel.
What are Indexed Files? The indexed files are those files in which the organization is always indexed, and the access is done using key values.
0コメント