Random Access Method


 

The random or direct access method allows the user to process logical records in a file using sector positioning and tabbing within each sector. By allocating a single record per sector (the sector size may be adjusted using BUFFER/FIX/FIXED to match the largest expected record), it is possible to position directly to any record in the file, rather than having to process sequentially through the file until the desired record is reached. However, since sector numbering begins with zero (0) and increments accordingly, the first record in the file (record 1) would be located at sector zero.

Note the following:

  1. The physical text file may be processed sequentially or randomly.

  2. If only one record is placed per sector, sector zero would contain record 1, sector 1 would contain record 2, sector 2 would contain record 3 and so on.

  3. Random records may be fixed or variable in length. However, since the positioning point of reference is based upon a fixed length sector rather than End Of Record (EOR) terminators, caution should be exercised when writing variable length records since they may end up being less than a sector or spanning more than one sector.

  4. Records written using the random method are not space compressed unless the *+ list control has been specified. The space compression technique utilized is the standard technique incorporated within the operating system so that the files are accessible by any program or utility compatible with the operating system in use.

 

 

See Also: Sequential Access Method, Indexed Sequential Access Method, Associative Access Method, Disk I/O Instructions

 



PL/B Language Reference Sequential Access Method Indexed Sequential Access Method