RECFM Parameter

Purpose

The RECFM (Record Format) parameter specifies the format and characteristics of records in a dataset. This parameter is crucial for defining how data is physically stored within datasets, affecting both storage efficiency and processing methods.

Key Benefit:

Properly specified RECFM ensures data integrity, optimal storage utilization, and compatibility with processing programs. It determines whether records have fixed or variable lengths and defines additional record attributes like blocking and control characters.

Where RECFM is Used

  • In DD statements within the DCB parameter
  • In IDCAMS utility DEFINE commands
  • In TSO ALLOCATE commands
  • In the DCB macro for assembler programs
  • In dynamic allocation (SVC 99) calls

Basic Syntax

jcl
1
2
3
//ddname DD DSN=dataset.name, // DCB=(RECFM=xx,...), // ...other parameters...

Where xx is a combination of one or more record format codes.

RECFM Values

RECFM values are composed of one or more of the following codes, combined to define the complete record format:

Basic Record Format Codes

CodeDescriptionUsage
FFixed-length recordsAll records have the same length, specified by LRECL
VVariable-length recordsRecords can have different lengths, up to the maximum specified by LRECL
UUndefined-length recordsRecords have no defined format; often used for load modules

Optional RECFM Modifiers

ModifierDescriptionCompatible With
BBlocked recordsF, V (e.g., FB, VB)
SStandard format (for F) or Spanned (for V)F, V (e.g., FS, VS)
AASA print control charactersF, V (e.g., FBA, VBA)
MMachine print control charactersF, V (e.g., FBM, VBM)
TTrack overflowF, V (seldom used in modern systems)

Common RECFM Combinations

CombinationDescriptionCommon Uses
FBFixed-length, blocked recordsMost common format for data files, source code libraries
VBVariable-length, blocked recordsText files, log files, output from programs with varying record sizes
FBAFixed-length, blocked, ASA control charactersPrint files and reports with ASA carriage control
VBAVariable-length, blocked, ASA control charactersReports with varying line lengths and ASA control
UUndefined record formatLoad modules, executable programs, binary data
VBSVariable-length, blocked, spanned recordsFor records that can exceed the LRECL and span multiple blocks

Record Format Structure Details

Fixed-Length Records (F, FB)

Fixed-length records all have the same length, specified by the LRECL parameter. For example, with RECFM=FB and LRECL=80:

  • Every record is exactly 80 bytes long
  • Multiple records can be stored in a single block if BLKSIZE > LRECL
  • With BLKSIZE=8000, each block would contain 100 records (8000 ÷ 80)

Fixed-Length (F) Record Structure:


┌────────────────────┐
│ Record 1 (80 bytes)│
├────────────────────┤
│ Record 2 (80 bytes)│
├────────────────────┤
│ Record 3 (80 bytes)│
└────────────────────┘
              

Variable-Length Records (V, VB)

Variable-length records include a 4-byte Record Descriptor Word (RDW) at the beginning of each record, containing the record length. For example, with RECFM=VB and LRECL=100:

  • Records can vary in length, up to 100 bytes (including the 4-byte RDW)
  • The actual data length is LRECL-4 (96 bytes maximum)
  • Blocks also have a 4-byte Block Descriptor Word (BDW)

Variable-Length (VB) Record Structure:


┌────┬──────────────────┐
│BDW │Block length      │
├────┼──────────────────┤
│RDW │Record 1 (varying)│
├────┼──────────────────┤
│RDW │Record 2 (varying)│
├────┼──────────────────┤
│RDW │Record 3 (varying)│
└────┴──────────────────┘
              

ASA and Machine Control Characters

When 'A' (ASA) or 'M' (Machine) control characters are specified in RECFM, the first byte of each record contains a control character that indicates carriage control operations for printers:

ASA CharacterMeaning
blank (' ')Single space
0Double space
-Triple space
+No advance (overprint)
1Form feed (new page)

Usage Examples

Fixed-Blocked Dataset

jcl
1
2
3
4
//SRCLIB DD DSN=USER.SOURCE.LIB, // DISP=(NEW,CATLG,DELETE), // SPACE=(CYL,(10,5)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=32720)

This example creates a new dataset with fixed-length blocked records, typically used for source code or data files with fixed record structures.

Variable-Blocked Dataset

jcl
1
2
3
4
//LOGFILE DD DSN=USER.APPLICATION.LOG, // DISP=(NEW,CATLG,DELETE), // SPACE=(CYL,(5,2)), // DCB=(RECFM=VB,LRECL=1024,BLKSIZE=32760)

This example defines a log file with variable-length records, which allows flexibility in record sizes for logging varying message lengths.

Print File with ASA Control

jcl
1
2
3
4
//REPORT DD DSN=USER.MONTHLY.REPORT, // DISP=(NEW,CATLG,DELETE), // SPACE=(CYL,(1,1)), // DCB=(RECFM=FBA,LRECL=133,BLKSIZE=13300)

This example defines a report file with ASA carriage control characters. The LRECL is 133 bytes: 1 byte for the ASA control character plus 132 bytes for the print line.

Load Module Library

jcl
1
2
3
4
//LOADLIB DD DSN=USER.LOAD.LIBRARY, // DISP=(NEW,CATLG,DELETE), // SPACE=(CYL,(10,5,10)), // DCB=(RECFM=U,BLKSIZE=32760)

This example creates a library for executable load modules using the undefined record format, which is appropriate for binary executable programs.

IDCAMS DEFINE for VSAM Dataset

jcl
1
2
3
4
5
6
7
8
9
//IDCAMS EXEC PGM=IDCAMS //SYSPRINT DD SYSOUT=* //SYSIN DD * DEFINE CLUSTER (NAME(USER.VSAM.KSDS) - RECORDSIZE(80 80) - /* LRECL specification */ INDEXED - KEYS(8 0) - CYLINDERS(5 1)) /*

For VSAM datasets, RECFM is implied by the dataset type (KSDS, ESDS, etc.) and is specified differently using RECORDSIZE.

RECFM and Performance

Record format has significant implications for I/O performance and storage efficiency:

  • Blocking (B): Blocked records improve I/O efficiency by reducing the number of physical I/O operations needed to process a dataset. Always use blocked records (FB, VB) unless there's a specific reason not to.
  • Fixed vs. Variable: Fixed-length records provide more predictable performance but might waste space if many records don't use their full length. Variable-length records are more space-efficient but have slightly higher processing overhead.
  • BLKSIZE Considerations: For optimal performance, set BLKSIZE to a multiple of LRECL for fixed-length records, and as large as practical (up to 32760 bytes) for both fixed and variable records.
  • System-Determined BLKSIZE: Modern z/OS systems can determine optimal block sizes if you omit BLKSIZE in the DCB parameter, which is often the best approach.

Common Issues and Troubleshooting

IssuePossible CausesSolutions
ABEND013-4CDCB attribute conflict between JCL and dataset
  • Use ISPF 3.2 or LISTCAT to check actual dataset attributes
  • Correct JCL to match dataset RECFM
Truncated recordsLRECL too small for data being written
  • Increase LRECL to accommodate larger records
  • For variable records, consider using spanned records (VS/VBS)
Corrupted print outputIncorrect or missing control characters
  • Ensure RECFM includes 'A' or 'M' for print files
  • Verify first byte of each record contains valid control character
I/O performance issuesInefficient RECFM/BLKSIZE combination
  • Use blocked records (FB, VB) instead of unblocked
  • Optimize BLKSIZE for track/device utilization
  • Consider system-determined block sizes

Best Practices

  1. Use Blocked Records: Always use blocked record formats (FB, VB) for improved I/O performance unless there's a specific requirement for unblocked records.
  2. Match RECFM to Data Characteristics: Choose fixed-length records for data with consistent size and variable-length for data with significant size variations.
  3. Optimize BLKSIZE with RECFM: Set BLKSIZE to maximize efficiency based on the RECFM and storage device characteristics, or let the system determine the optimal value.
  4. Be Consistent: Maintain consistent RECFM/LRECL/BLKSIZE specifications across related datasets to avoid processing errors.
  5. Document Special RECFMs: If using unusual RECFM combinations (like FBS or VBS), document the reasons and implications for maintenance purposes.
  6. Consider Standard Values: Use standard RECFM/LRECL combinations for common datasets:
    • Source code: RECFM=FB, LRECL=80
    • Print files: RECFM=FBA, LRECL=133
    • Load libraries: RECFM=U, BLKSIZE=32760
    • Variable data: RECFM=VB, LRECL=(appropriate size), BLKSIZE=32760

JES2 vs JES3 Considerations

The RECFM parameter is part of the data management system rather than the job entry subsystem, so it functions identically in both JES2 and JES3 environments.

However, there are a few considerations regarding spool datasets:

FeatureJES2JES3
SYSOUT handlingJES2 handles RECFM for SYSOUT datasets automaticallyJES3 handles RECFM for SYSOUT datasets automatically
Internal spool formatJES2 uses its own internal formatJES3 uses its own internal format

Note:

When specifying RECFM for SYSOUT datasets, the settings may be used for external writers or post-processing programs, but JES itself manages the internal spool format.

Related Concepts

  • DSORG Parameter - Dataset organization that works with RECFM
  • LRECL Parameter - Logical record length, which defines the size of each record
  • BLKSIZE Parameter - Block size, which determines how many records are stored in each physical block
  • DCB Parameter - Data Control Block parameters that include RECFM, LRECL, and BLKSIZE
  • DSNTYPE Parameter - Dataset type specification, which can affect valid RECFM choices