The following terms must be clearly differentiated in order to understand the various block and file formats described below:
PAM block
logical block (data block)
transfer unit
PAM block: A PAM block comprises 2048 bytes plus a PAM key of 16 bytes. Following the introduction of the NK disk format, it has now become customary to treat the size of a PAM block as 2048 bytes without the PAM key. A PAM block is also referred to as a PAM page or a 2-Kbyte data block.
Logical block: A logical block is a contiguous area containing data or records. Its size is specified by the BUFFER-LENGTH operand of the ADD-FILE-LINK command or the BLKSIZE operand of the FILE macro. This specification can be given in the form
*STD(SIZE=n) or (STD,n), or as a specific number of bytes.
(STD,n) means that a logical block is made up of n units of 2048 bytes each. (n must be an even number for files to be allocated on NK4 disks.)
In the case of tape files and cartridges, the length can also be explicitly specified in bytes. However, this specification only defines the maximum length of the logical block. The actual length, which must be less than or equal to n bytes, is determined by the data itself.
Transfer unit: A transfer unit indicates the amount of data that can be transported as a unit between main memory and a disk with one physical I/O operation.
The transfer unit for disks is equal to the length of a logical block. For NK2 disks, the transfer unit is a multiple of 2 Kbytes (which means that the smallest transfer unit is 2 Kbytes); for NK4 disks, a multiple of 4 Kbytes (so the smallest transfer unit is 4 Kbytes).
Two different cases must be distinguished for tapes:
The block length of a file is specified as BLKSIZE=(STD,n) in the macro or as BUFFER-LENGTH=*STD(SIZE=n) in the command. This defines a logical block length of n * 2 Kbytes for tape files. The transfer unit in this case is 2 Kbytes. This means that n * 2048 bytes are transported as a unit. In other words, n I/Os of 2 Kbytes each are executed.
If the block length of a file is specified as BLKSIZE=n in the macro or as BUFFER-LENGTH=n in the command. This specification defines a logical block length of n bytes for tape files. So n bytes are transferred in each I/O. In this case, the logical block length and the transfer unit are identical for tape files as well.
DMS offers a number of different file/block formats to support the various disk formats. The two basic block formats are:
block format with PAM keys, referred to below as the K (key) file format
block formats without PAM keys, also known as NK (non-key) file formats.
K file format
The block-specific management information (block control information) is held in the PAM key (16 bytes). 8 bytes of the PAM key is used by the system, the other 8 bytes are used by the higher-level access methods SAM and ISAM. The user can only access this “user” part of the PAM key with UPAM. The user should, however, refrain from using this part of the PAM key so as to simplify subsequent conversion of his applications to NK format.
This block format is supported by all access methods except DIV and FASTPAM. A file can be created in K format if the volume allows the PAM key to be recorded (K pubset or K private disk).
See the sections on the individual access methods for more details.
BLOCK-CONTROL-INFO=*PAMKEY
A K format is defined by means of the operand BLOCK-CONTROL-INFO=*PAMKEY of the ADD-FILE-LINK command or the operand BLKCTRL=PAMKEY of the FILE macro.
The structure of a PAM block with the associated PAM key is shown below:
NK file formats
A distinction is made between three different NK file formats in which block-specific management information is held within each data block (BLOCK-CONTROL-INFO= *WITHIN-DATA-BLOCK/*WITHIN-DATA-2K-BLOCK/*WITHIN-DATA-4K-BLOCK in the ADD-FILE-LINK command).
This area is not available for user data.
Besides the above formats, the user may also select an NK file format in which no blockspecific management information is stored (BLOCK-CONTROL-INFO=*NO).
When the UPAM and SAM access methods are used, the block specific management information is always 16 bytes long (12 bytes block control field and 4 bytes data length field).
In the case of an NK2-ISAM file (BLOCK-CONTROL-INFO=*WITHIN-DATA-2K-BLOCK), the block control information is stored in the first 16 bytes of each 2-Kbyte block.
For an NK4-ISAM file (BLOCK-CONTROL-INFO=*WITHIN-DATA-4K-BLOCK), it is stored in the first 16 bytes of each 4-Kbyte block.
The following must be observed when converting a K file to an NK file:
if the maximum record length (16 PAM blocks = 32 Kbytes) is exhausted, incompatibilities may occur, since there is no space available for the block control information.
Only NK4 files may be stored on an NK4 disk.
See the sections on the individual access methods for more details.
BLOCK-CONTROL-INFO=*WITHIN-DATA-BLOCK
An NK format is defined by the operand BLOCK-CONTROL-INFO=*WITHIN-DATA-BLOCK of the ADD-FILE-LINK command or the operand BLKCTRL=DATA of the FILE macro. Either an NK2 or an NK4 file is created in the process:
When a file is created, its format is determined as follows:
PAM and SAM files:
If the blocking factor n is an odd number, an NK2 file is created.
If the blocking factor n is an even number, an NK4 file is created.
ISAM file:
If the block format of the ISAM file is not explicitly specified (see below), the format of the disk on which the ISAM file is created determines whether an NK2-ISAM or NK4-ISAM file is created.
A file that has already been opened can be opened without regard to the block format.
The following diagram illustrates the logical data block of an NK2-SAM file (with length 6 Kbytes and blocking factor n=3; bl.m stands for block-specific management information):
BLOCK-CONTROL-INFO=*WITHIN-DATA-2K-BLOCK (for NK-ISAM files)
An NK2 file can be created explicitly by using the operand BLOCK-CONTROL-INFO= *WITHIN-DATA-2K-BLOCK in the ADD-FILE-LINK command or the operand BLKCTRL=DATA2K in the FILE macro (this specification can also be made for SAM and PAM; it then functions like *WITHIN-DATA-BLOCK).
The block-specific management information is held in the first 16 bytes of each 2-Kbyte data block.
The following diagram illustrates the logical data block of an NK2-ISAM file (with length 6 Kbytes and blocking factor n=3; bl.m stands for block-specific management information):
BLOCK-CONTROL-INFO=*WITHIN-DATA-4K-BLOCK (for NK-ISAM files)
An NK4 file can be created explicitly by using the operand BLOCK-CONTROL-INFO= *WITHIN-DATA-4K-BLOCK in the ADD-FILE-LINK command or the operand BLKCTRL=DATA4K in the FILE macro (this specification can also be made for SAM and PAM; it then functions like *WITHIN-DATA-BLOCK).
The block-specific management information is held in the first 16 bytes of each 4-Kbyte data block.
An NK4-ISAM file can be created on any disk.
The following diagram illustrates the logical data block of an NK4-ISAM file (with length 12 Kbytes and blocking factor n=6; bl.m stands for block-specific management information):
BLOCK-CONTROL-INFO=*NO
An NK format can also be defined by using the operand BLOCK-CONTROL-INFO=*NO in the ADD-FILE-LINK command or the operand BLKCTRL=NO in the FILE macro.
In this case, the system does not store any block-specific management information in the PAM key or within the data block.
This format is only available for UPAM disk files, UPAM tape files and SAM tape files.
In the case of SAM disk files and ISAM disk files, the operands BLOCK-CONTROL-INFO=*NO and BLKCTRL=NO are internally converted to BLOCK-CONTROL-INFO= *WITHIN-DATA-BLOCK and BLKCTRL=DATA, respectively.
See the sections on the individual access methods for more details.
The following diagram illustrates the logical data block of an NK2-PAM file without blockspecific management information (with length 6 Kbytes and blocking factor n=3):
DMS offers a number of different file/block formats to support the various disk formats. The interactions and interdependencies among the following file attributes should be taken into account when specifying the file format:
file structure
block structure
logical block length (blocking factor)
The following file formats and other file attributes may be combined:
File format | File structure | Block structure | Logical block length | Blocking factor (n) | Disk format |
---|---|---|---|---|---|
K file | PAM | PAMKEY | |||
SAM | |||||
ISAM | |||||
NK2 file | PAM | NO or DATA | STD | odd | K disk |
SAM | DATA | STD | odd | ||
ISAM | DATA2K | ||||
DATA | NK2 disk | ||||
NK4 file | PAM | NO or DATA | STD | odd | K disk |
SAM | DATA | STD | odd | NK2 disk | |
ISAM | DATA4K | STD | odd | NK4 disk |
The minimum allocation unit has no effect on the file format.
Only files with an even blocking factor can be stored on NK4 disks.
The K file format is supported by all previously released BS2000 versions.