Please enable JavaScript to view this site.

A-Shell Reference

Historically under AMOS, all disk I/O was organized around 512 byte blocks. Because of this, logical records in a file were not split across block boundaries. Instead, filler bytes were simply added to the end of each block as needed. For example, if the record size were 170 bytes, three records would fit within a block (3 x 170 = 510) with two bytes left over. In this case, each block would have two wasted bytes at the end. Eventually, under AMOS 2.x, this requirement was lifted, but you had to specify the span'blocks modifier on the file open statement to force it to allow logical records to be split across blocks. For example:

Open #1, "myfile.dat", random'forced, 170, recnovar, span'blocks

This method is certainly more efficient in terms of disk space, but possibly less efficient in terms of performance, so it never became very popular. However, under Unix and Windows, it is virtually always more efficient in all cases. In addition to eliminating wasted space, it also lends itself to optimization involving the reading and writing of arrays of records at a time. (The BASORT subroutine, for example, uses this technique with its temporary files.) Thus, thus the use of span'blocks is highly recommended under A-Shell.

Span'blocks is automatic whenever the record size is greater than 512 and irrelevant if the record size divides evenly into 512. It is also automatic for ISAM-A files. However, note that for any given file, if you use span'blocks in one program, you need to use it in all the programs that access that file, since it does affect the way the data is organized on disk.