Basic sequential access method
In IBM mainframe operating system environments, the Basic Sequential Access Method (BSAM) functions as an access method designed for sequential reading and writing of datasets. BSAM is supported on platforms such as OS/360, OS/VS2, MVS, z/OS, and their derivatives.
BSAM primarily caters to devices that inherently operate sequentially, including punched card readers and punches, line printers, and magnetic tape. Additionally, it is utilized for data stored on devices capable of direct addressing, like magnetic disks. By employing consistent API calls across various hardware, BSAM achieves device independence.
Unlike the more sophisticated but less adaptable Queued Sequential Access Method (QSAM), which accesses logical records within physical blocks, BSAM works directly with physical blocks of data. Users of BSAM must manage the occurrence of short (truncated) blocks, particularly near the end of datasets—a constraint not present in QSAM.
Application program interface
To engage BSAM, programmers set DSORG=PS within the Data Control Block (DCB). As a fundamental access method, BSAM performs asynchronous reading and writing of data blocks, necessitating verification of completion through the CHECK macro. It relies on standard system macros such as OPEN, CLOSE, READ, WRITE, and CHECK. The NOTE macro provides the position of the most recently accessed block, while POINT allows repositioning to a previously noted location.
For datasets without blocking—where the logical record size matches the physical block size—BSAM can emulate direct access by utilizing NOTE and POINT macros on devices that support direct access (DEVD=DA), facilitating basic direct-access operations.
Similar facilities
The BSAM API mirrors file operation concepts such as open, read, write, and close found in other operating systems like Unix and Windows. The POINT macro serves a role analogous to seek or lseek, whereas NOTE corresponds to ftell.
See also
- Queued Sequential Access Method (QSAM)
- Hierarchical Sequential Access Method (HSAM)
- Basic Indexed Sequential Access Method (BISAM)
- Queued Indexed Sequential Access Method (QISAM)
- Hierarchical Indexed Sequential Access Method (HISAM)