SAM is a record-oriented access method used to process files sequentially. SAM can be used to write to, update and read records. SAM also features a positioning function which permits positioning at the logical start or end of a file or at any existing record.
As SAM is a record-oriented access method, it carries out the blocking, deblocking and buffering of the records for the user. If two I/O areas are available in the user program, exchange buffer operation can be used. If only one I/O area is provided, no overlapped processing is possible.
SAM is virtually device-independent and permits the processing of files on disks and tapes; tape cartridges are essentially handled like normal magnetic tapes.
The access method SAM is capable of processing files with different block formats (see the section dealing with access methods in the “Introductory Guide to DMS” [1]).
K-SAM files, i.e. files with a PAM key, have the conventional block format “PAMKEY”. They are characterized by the fact that DMS management information for each PAM page is held in a separate PAM key located outside the page.
NK-SAM files, i.e. PAM files without a PAM key (non-key PAM files), have the block format “DATA” or “NO”. They do not contain separate PAM keys. With the block format “DATA”, the DMS management information is kept in a block control field within the PAM page.
No such block-specific management information is supported for the block format “NO”.
By way of the BLKCTRL operand in the macros FILE and FCB, the user can select whether a K file or an NK file is to be processed: BLKCTRL=PAMKEY defines a K-SAM file, BLKCTRL=DATA or BLKCTRL=NO specifies an NK-SAM file.
Macros for the SAM access method
The following action macros are available for processing files with SAM:
Macro | Function |
FCB | set up file control block. |
FEOV | for tape files: initiate tape swap. |
GET | read sequentially; records are retrieved one after the other. |
PUT | write sequentially: in move mode, record blocking is handled by the logical routines of the access methods i.e. output to the data volume is delayed until the output buffer is full; the buffers are served automatically by the system; in locate mode, blocking must be handled by the user. |
PUTX | a record that has been read is replaced (for disk files in locate mode only). |
RELSE | terminate a data block i.e. for input files:the next GET causes the next data block to be read; for output files: the next PUT causes the buffer contents to be written as a data block, the next record becoming the first record in the new data block (this is necessary in locate mode if the next record no longer fits in the current buffer). |
SETL | position to a certain record in the file, to beginning-of-file or to end-of-file. |