Fixed Length
In mainframe computing, **Fixed Length** refers to data elements, records, or files where every instance occupies a predetermined, constant amount of storage space. This means each record or field within a dataset or program has the exact same size, regardless of the actual data it contains.
Key Characteristics
-
- Constant Size: Every record or field within a fixed-length structure occupies an identical number of bytes, defined at the time of its creation or declaration.
- Predictable Storage: Storage allocation is straightforward and predictable, as the exact size of each component is known in advance, simplifying space management and calculation.
- Direct Access: For fixed-length records, calculating the offset to a specific record is simple (record number * record length), enabling efficient direct access in certain file organizations like
BDAM. - No Length Indicators: Unlike variable-length formats, fixed-length records do not require explicit length fields or delimiters, as their size is implicitly known by the system or application.
- Common in COBOL: Widely used in COBOL programs for defining data items (e.g.,
PIC X(10)) and record layouts withinFILE SECTIONorWORKING-STORAGE SECTION. - Record Format (RECFM): Often associated with
RECFM=FB(Fixed Blocked) orRECFM=F(Fixed Unblocked) datasets in JCL, whereLRECLspecifies the fixed record size.
Use Cases
-
- COBOL Data Definitions: Defining elementary data items in COBOL using
PICclauses, such as05 CUSTOMER-ID PIC X(10).or05 AMOUNT PIC S9(7)V99 COMP-3., where each field has a predefined length. - Sequential Files (RECFM=FB): Creating flat files on disk (DASD) or tape where all records have the same length, specified by
LRECLin the JCLDDstatement for efficient batch processing. - DB2 Table Columns: Defining columns in a DB2 table with fixed-length data types like
CHAR(N),SMALLINT,INTEGER,DECIMAL(p,s), where each entry occupies a consistent number of bytes. - IMS Segments: In IMS databases, segments can be defined with a fixed length, ensuring uniform storage for all occurrences of that segment type within a physical database.
- Print Files: Generating reports where each line is a fixed length (e.g., 132 characters), suitable for traditional line printers or spool files.
- COBOL Data Definitions: Defining elementary data items in COBOL using
Related Concepts
Fixed Length is a fundamental concept often contrasted with Variable Length (RECFM=VB or RECFM=V), where record or field sizes can differ, typically requiring length indicators. It directly influences the LRECL (Logical Record Length) parameter in JCL DD statements, which specifies the exact size of each record. When used with RECFM=FB, it also impacts BLKSIZE (Block Size), as multiple fixed-length records are grouped into blocks for I/O efficiency, with BLKSIZE being a multiple of LRECL. In COBOL, fixed-length definitions are integral to data structures and file processing, dictating how data is read from and written to datasets.
- Accurate LRECL Definition: Always ensure the
LRECLparameter in JCL accurately matches the defined fixed