end closeprocedure set (var rriderffileposinteger)begin (*assume nil* :fr eof :falseif pos > then if pos < len then pos :pos else pos : len end else pos : end end setprocedure write (var rriderchchar)begin if ( pos < len( pos maxlengththen [ pos:chinc( pos)if pos len then inc( lenend else eof :true end end writeprocedure read (var rridervar chchar)begin if pos len then ch : [ pos]inc( poselse eof :true end end readprocedure writeint (var rriderninteger)begin (*implementation is platform dependent*end writeintprocedure readint (var rridervar ninteger)begin (*implementation is platform dependent*end readintend files note that in this example the maximum length that sequences may reach is an arbitrary constant should program cause sequence to become longerthen this would not be mistake of the programbut an inadequacy of this implementation on the other handa read operation proceeding beyond the current end of the sequence would indeed be the program' mistake herethe flag eof is also used by the write operation to indicate that it was not possible to perform it hence~ eof is precondition for both read and write buffering sequences when data are transferred to or from secondary storage devicethe individual bits are transferred as stream usuallya device imposes strict timing constraints upon the transmission for exampleif data are written on tapethe tape moves at fixed speed and requires the data to be fed at fixed rate when the source ceasesthe tape movement is switched off and speed decreases quicklybut not instantaneously thus gap is left between the data transmitted and the data to follow at later time in order to achieve high density of datathe number of gaps ought to be kept smalland therefore data are transmitted in