A computer program product for buffered writing of datasets and end longitudinal positions on a magnetic recording tape and validating the end longitudinal positions during reading of a later dataset thereafter, the computer program product comprising a computer readable storage medium having program instructions embodied therewith, the program instructions readable and/or executable by a controller to cause the controller to:
- receive, by the controller, a plurality of records;
- store, by the controller, datasets associated with the plurality of records in a buffer memory;
- write, by the controller, the datasets stored in the buffer memory to the magnetic recording tape in response to a predetermined number of datasets being stored in the buffer memory;
- for each of the datasets being written, determine, by the controller, an end longitudinal position indicative of a physical position where the dataset is physically written to the magnetic recording tape;
- for each determined end longitudinal position, store, by the controller, the end longitudinal position and an identifier of the associated dataset to a table of a dataset that is to be subsequently written to the magnetic recording tape;
- receive, by the controller, a request for reading a given one of the records;
- estimate, by the controller, a logical position on the magnetic recording tape of the dataset that contains the requested record;
- initiate, by the controller, a read operation beginning at a position of the magnetic recording tape before the estimated logical position;
- and
- continue, by the controller, the read operation past the estimated logical position for a predetermined number of datasets prior to validating an end longitudinal position of the dataset that contains the requested record.