z/OS concepts
Previous topic | Next topic | Contents | Glossary | Contact z/OS | PDF


Data set record formats

z/OS concepts

Traditional z/OS® data sets are record oriented, and have one of five possible formats.

In normal usage, there are no byte stream files such as are found in PC and UNIX® systems. (z/OS UNIX has byte stream files, and byte stream functions exist in other specialized areas. These are not considered to be traditional data sets.)

In z/OS, there are no new line (NL) or carriage return and line feed (CR+LF) characters to denote the end of a record. Records are either fixed length or variable length in a given data set. When editing a data set with ISPF, for example, each line is a record.

Traditional z/OS data sets have one of five record formats, as follows:
F (Fixed)
Fixed means that one physical block on disk is one logical record and all the blocks and records are the same size. This format is seldom used.
FB (Fixed Blocked)
This format designation means that several logical records are combined into one physical block. This format can provide efficient space utilization and operation. This format is commonly used for fixed-length records.
V (Variable)
This format has one logical record as one physical block. A variable-length logical record consists of a record descriptor word (RDW) followed by the data. The record descriptor word is a 4-byte field describing the record. The first 2 bytes contain the length of the logical record (including the 4-byte RDW). The length can be from 4 to 32,760 bytes. All bits of the third and fourth bytes must be 0, because other values are used for spanned records. This format is seldom used.
VB (Variable Blocked)
This format places several variable-length logical records (each with an RDW) in one physical block. The software must place an additional Block Descriptor Word (BDW) at the beginning of the block, containing the total length of the block.
U (Undefined)
This format consists of variable-length physical records and blocks with no predefined structure. Although this format may appear attractive for many unusual applications, it is normally used only for executable modules.

We must stress the difference between a block and a record: a block is what is written on disk, while a record is a logical entity.

The terminology here is pervasive throughout z/OS literature. The key terms are:

  • Block Size (BLKSIZE) is the physical block size written on the disk for F and FB records. For V, VB, and U records, it is the maximum physical block size that can be used for the data set.
  • Logical Record Size (LRECL) is the logical record size (for formats F and FB) or the maximum allowed logical record size (for formats V and VB) for the data set. Format U records have no LRECL.
  • Record Format (RECFM) is F, FB, V, VB, or U as just described.

These terms are known as data control block (DCB) characteristics, named for the control block where they may be defined in an assembly language program. The user is often expected to specify these parameters when creating a new data set. The type and length of a data set are defined by its record format (RECFM) and logical record length (LRECL). Fixed-length data sets have a RECFM of F, FB, FBS, and so on. Variable-length data sets have a RECFM of V, VB, VBS, and so on.

A data set with RECFM=FB and LRECL=25 is a fixed-length (FB) data set with a record length of 25 bytes (the B is for blocked). For an FB data set, the LRECL tells you the length of each record in the data set; all of the records are the same length. The first data byte of an FB record is in position 1. A record in an FB data set with LRECL=25 might look like this:
Positions 1-3: Country Code = 'USA'
Positions 4-5: State Code = 'CA'
Positions 6-25: City = 'San Jose' padded with 12 blanks on the right
A data set with RECFM=VB and LRECL=25 is a variable-length (VB) data set with a maximum record length of 25 bytes. In a VB data set, the records can have different lengths. The first four bytes of each record contain the RDW, and the first two bytes of the RDW contain the length of that record (in binary). The first data byte of a VB record is in position 5, after the 4-byte RDW in positions 1-4. A record in a VB data set with LRECL=25 might look like this:
Positions 1-2: Length in RDW = hex 0011 = decimal 17
Positions 3-4: Zeros in RDW = hex 0000 = decimal 0
Positions 5-7: Country Code = 'USA'
Positions 8-9: State Code = 'CA'
Positions 10-17: City = 'San Jose'

Figure 1 shows the relationship between records and blocks for each of the five record formats.

Figure 1. Basic record formats




Copyright IBM Corporation 1990, 2010