Basic, in IBM terminology, indicates a lower-level access method that deals with data sets in terms of physical blocks and does not provide either read-ahead, called anticipatory buffering, or synchronization — that is, the user program has to explicitly wait for completion of each input/output event. With BDAM, "the programmer can directly store and retrieve a block by specifying either its actual [|device address], its [|relative position] within a data set, or the [|relative track] within a data set at which the system is to begin a search. BDAM provides no index or structure to the file except as programmed by the application. In many applications, a hashing or randomizing function may be used to assign the block address based on a key in the data. If physical keys are used, the key of the last record within the block must be written as the key for that block. The BDAM application program interface can be compared with the interface offered by open, read, write and close calls in other operating systems such as Unix and Windows. BDAM is still supported by IBM as of 2012. Because of its dependence on physical device geometry new IBM direct-access devices used with z/OS emulate IBM 3390 devices regardless of their real physical characteristics.
The programmer specifies DSORG=DA in his Data Control Block to indicate use of BDAM. Space can be in up to 16 extents on each volume. The data set can reside in up to 255 extents across multiple volumes. If the application has a dependency on the space being on contiguous tracks, you can allocate space for the direct data set in contiguous tracks by coding SPACE= on the DD statement. Direct data sets must be preformatted before use by opening them as output and writing all the blocks sequentially. This can load all "dummy" records or load initial data. As a basic access method BDAM reads and writes member data in blocks and the I/O operation proceeds asynchronously and must be tested for completion using the CHECK macro. BDAM uses the standard system macros OPEN, CLOSE, READ, WRITE,and CHECK. The READ or WRITE macro instructions must provide the block address or key of the desired record. The CHECK macro has to be used to wait for completion of a specific operation before the data can be accessed or the data buffer reused. It is possible to start multiple input/output operations to run concurrently. Records in a direct data set can contain user-specified recorded keys of up to 255 bytes—all keys in a file must be the same length. Reads and writes can specify a key in addition to a disk address, and BDAM will search starting at the requested block up to the entire area of the file for a record with a matching key. This allows multiple keys hashing to the same track to be handled automatically by the I/O subsystem.
Disk addresses
BDAM accepts disk addresses as either actual device addresses, as relative track addresses, or as relative block numbers. Device addresses are eight byte fields in the form MBBCCHHR. All subfields are binary numbers.
M is the extent number for files with more than one extent.
R is the record numberon the track. Record zero contains control information for the track and can not be used.
Specifying device addresses makes the dataset unmovable. Relative track addresses are three byte fields in the form TTR. All subfields are binary numbers.
TT is the relative track number in the file, starting with zero.
R is the record number on the track.
Relative block numbers are four byte binary numbers indicating the block number in the file. The first block is block 0. This form of addressing can only be used with fixed length blocks.