bdfg1m0eGeneral Information

Subfile Components

Each subfile contains a prime block and possibly one or more overflow blocks. The prime and overflow blocks contain logical records (LRECs). LRECs contain the actual data stored in the database.

Figure 3 shows a file that contains two subfiles. Each subfile shown in the figure has a prime block and three overflow blocks, but subfiles can have any number of overflow blocks, or none.

Figure 3. Logical Structure of a TPFDF File


Blocks

If the volume of data in a subfile is more than will fit into the prime block, TPFDF automatically allocates one or more overflow blocks to hold the extra data. It chains any overflow blocks to the prime block that requires them. See Figure 4.

Figure 4. Prime Blocks and Overflow Blocks


All physical blocks in a file, whether they are prime or overflow blocks, have the same file ID. This is a 2-byte identifier that is held in the block header. (It is known in TPF systems and ALCS environments as the record ID.)

Block Sizes

TPFDF supports three block sizes when running with TPF. These block sizes are:

L1
381 bytes

L2
1055 bytes

L4
4095 bytes.

When running with ALCS, TPFDF supports eight block sizes, L1 to L8. ALCS block sizes are defined during ALCS installation. The L1, L2, and L4 block sizes are usually defined to be the same as the L1, L2, and L4 TPF block sizes.

The database administrator defines the block sizes for any TPFDF file. Prime and overflow blocks can be different sizes.

Block Headers and Trailers

Each block contains a header and an optional trailer. The block header consists of the following:

The optional block trailer is 36 bytes long and contains control information such as the last command issued and the date and time the block was last updated.

The trailer can provide useful information for debugging programs. When using trailers, at least 62 bytes of each block are reserved for TPFDF use. The trailer can also include an optional extension (of any length) that the application program can use for any purpose.

Each overflow block has the same amount of space reserved for the header and optional trailer as the prime block. (The header and trailer information can be different in prime and overflow blocks.)

Ordinal Numbers

The number of prime blocks in a fixed file is also called the number of ordinals in the file. The file has absolute start and end ordinal numbers that are used by TPFDF macros.

LRECs

The internal format of individual TPFDF files does not correspond to the internal formats of records in a traditional TPF or ALCS database. In every TPFDF file, the data is organized into logical groups called logical records (LRECs). Each logical record has mandatory items that allow TPFDF to recognize and work with it. These items include a logical record identifier (LREC ID) and, for variable-length and extended LRECs, the size of the LREC.

An LREC is the smallest unit of data that an application program can read, add, or delete. LRECs have LREC IDs that are used as primary keys when reading LRECs from, or adding LRECs to, a subfile.

LRECs cannot span blocks. Their size is limited to the physical block size, minus the length of the following components (the block header, optional block header extension, optional trailer, and optional trailer extension).

Figure 5 shows how LRECs are held in blocks.

Figure 5. LRECs in a Block


LREC Types

LRECs can be:

LREC Fields

A field is a subdivision of an LREC that contains an item of data. Fields hold one of the following:

In variable-length (and extended) LRECs, user fields can vary in length.