When creating a SAM file, DMS places a retrieval address in the FCB. This address can be used for direct access during subsequent processing. It consists of a block number and a record number. The block number always refers to a logical data block (not to a PAM page), the record number indicates the position of the record within the indicated block. For multivolume files, it should be noted that the block number is maintained only within each volume.
In the 31-bit TU FCB, i.e. for XS programming, the retrieval address is split into two fields, each one word long: the field ID1BLK# contains the block number within the file and the field ID1REC# contains the record number within this block. Both fields are incremented automatically by the system. Whenever a data transfer operation is initiated, the record counter is automatically reset.
For non-XS programming, the retrieval address is kept in field ID1RPTR of the 24-bit TU FCB in the form “bbbbbbrr”, where
“bbbbbb” is the number of the data block in the file and
“rr” is the number of the record within the block.
The record counter is not automatically incremented by the system; the user must do this in his program if he/she wants to use the retrieval address. However, the record counter is automatically reset whenever a data transfer operation is initiated. For tape files, it should be noted that the retrieval address for non-XS programming is returned only for files with standard blocks, which means that SETL R cannot be used for files with nonstandard blocks.
XS interface: 31-bit-TU-FCB | Non-XS interface: 24-bit-TU-FCB | ||
---|---|---|---|
ID1BLK# (1 word) | ID1REC# (1 word) | ID1RPTR (1 word) | |
Byte 1-3 | Byte 4 | ||
Block number | Record number | Block number | Record number |
The first record in a file thus has the following retrieval address:
in the 31-bit TU FCB00000001 in field ID1BLK# and 00000001 in field ID1REC#
in the 24-bit TU FCB00000101 in field ID1RPTR
The table below indicates the values of the retrieval address after the action macros SETL B and SETL E as a function of the open mode.
OPEN mode | SETL B | SETL E | ||||
---|---|---|---|---|---|---|
ID1BLK# | ID1REC# | ID1RPTR | ID1BLK# | ID1REC# | ID1RPTR | |
INPUT, UPDATE | - | - | - | max. | 1 | max. 1 |
OUTPUT | 1 | 0 | 1 0 | error | error | error |
EXTEND | 1 | 0 | 1 0 | error | error | error |
REVERSE | - | - | - | - | - | - |
- | Field contents unchanged. |
max. | Highest block number. |
Field IDRPTR contains both the block and record counters.
The table below describes the manner in which the action macros supplies a value for the retrieval address.
Macro | Value supplied for the retrieval address |
---|---|
GET | If a data transfer is necessary for the specified record, the block counter contains the logical block number and the record counter is reset. For XS programming, the record counter is updated by each action macro. |
PUT | If the PUT macro results in a data transfer for the specified record, the block counter is updated and the record counter is reset. The block counter thus contains the number of the new data block which is to receive the record. For XS programming, the record counter is updated by each action macro. |
RELSE | If a file is to be created or extended (OPEN OUTPUT/EXTEND), the block counter contains the number of the data block which is to receive the following record and the record counter is set to zero. |
FEOV | After a tape swap, the block and record counters are reset for the new tape by the system. |
Example
The file attributes are defined:
using the FILE macro:
BLKCTRL=PAMKEY,
BLKSIZE=(STD,2),
RECFORM=F,
RECSIZE=512
or
using the ADD-FILE-LINK command:
BLOCK-CONTROL-INFO=*PAMKEY,
BUFFER-LENGTH=*STD( SIZE=2),
RECORD-FORMAT=*FIXED,
RECORD-SIZE=512
The retrieval address is:
Retrieval address | |||
---|---|---|---|
31-bit-TU-FCB | 24-bit-TU-FCB | ||
ID1BLK# | ID1REC# | IDRPTR | |
for record 10 | 00000002 | 00000002 | 00000202 |
for record 20 | 00000003 | 00000004 | 00000304 |
Information on processing SAM node files
If a data block is closed with RELSE during a write process on a SAM node file before it has been filled completely, the retrieval addresses are only valid from that moment on for as long as the file is open.
CLOSE and re-OPEN results in a different distribution of the data sets of the node file on the SAM blocks, which are transferred to the access method for processing; this means the previous retrieval addresses do not match the file anymore!
The same is true for processing with OPEN UPDATE. If a SAM node file was opened and enhanced in UPDATE mode, the retrieval addresses become invalid as soon as the file is closed and opened again.
This behavior of SAM node files (Net-Storage) is incompatible with the processing of SAM files on conventional public space, where the block and record structure remains unchanged even after CLOSE and OPEN. Because of this, the application must set the indicator SAM_NODE_FILE_ENABLE in the file control block (FCB) before it opens the file, to indicate that it is capable of processing SAM node files correctly.