MainframeMaster

JCL Tutorial

DCB Parameters

Understanding Data Control Block parameters for defining dataset characteristics in JCL

Progress0 of 0 lessons

Introduction to DCB Parameters

When defining a dataset in JCL, you need to specify its physical and logical characteristics. The Data Control Block (DCB) parameters provide this essential information to the system, enabling it to correctly process and access the dataset. DCB parameters define attributes like record format, record length, block size, and dataset organization.

Proper DCB specification is crucial for dataset accessibility, data integrity, and system performance. Incorrect DCB parameters can lead to I/O errors, data corruption, or inefficient resource utilization.

Basic DCB Syntax:

jcl
1
2
//ddname DD DSN=dataset.name,DISP=SHR, // DCB=(RECFM=FB,LRECL=80,BLKSIZE=8000,DSORG=PS)

You can specify DCB parameters either directly within the DD statement or by referencing a model dataset with the appropriate DCB characteristics. This tutorial will explore all these approaches.

Data Control Block Concepts

The Data Control Block (DCB) is a control block used by the operating system to manage I/O operations for datasets. It contains information about a dataset's physical and logical characteristics, access methods, and buffer requirements.

DCB Creation and Usage

A DCB is created when a dataset is opened and remains active until the dataset is closed. The information in the DCB comes from various sources, with the following priority (highest to lowest):

  1. The program's data definition (DCB macro in assembler, file definition in COBOL, etc.)
  2. The DD statement in JCL
  3. The dataset label for existing datasets
  4. Default values from the system

If a required DCB parameter is not specified in any of these sources, the job may fail with an I/O error.

Key DCB Parameters

The most commonly used DCB parameters are:

  • RECFM (Record Format) - Defines how records are structured in the dataset
  • LRECL (Logical Record Length) - Specifies the length of each logical record
  • BLKSIZE (Block Size) - Defines the size of physical blocks on the storage medium
  • DSORG (Dataset Organization) - Indicates how the dataset is organized (sequential, partitioned, etc.)

Best Practice:

Always specify DCB parameters explicitly when creating new datasets to ensure that the dataset has the correct attributes. When accessing existing datasets, most DCB parameters can be omitted as they will be obtained from the dataset label.

RECFM (Record Format)

The RECFM parameter specifies the format of the records in a dataset. It defines how records are stored, whether they have control characters, and whether they are blocked.

Basic Record Formats

The primary record format types are:

FormatDescriptionCharacteristics
F (Fixed)All records have the same length
  • All records are exactly the same size (LRECL)
  • Easy to process and access
  • May waste space if data is shorter than record length
V (Variable)Records have varying lengths
  • Each record has a 4-byte Record Descriptor Word (RDW) prefix
  • RDW contains the length of the record
  • More efficient for data with varying lengths
  • Maximum length defined by LRECL
U (Undefined)No specific record format
  • Used for data with unpredictable structure
  • No record boundaries maintained by the system
  • Application must handle record boundaries
  • Common for load modules and object code

Record Format Modifiers

RECFM can include modifiers that provide additional information about the record format:

ModifierDescription
B (Blocked)Multiple logical records are stored in a single physical block. This improves I/O efficiency and storage utilization. Can be combined with F or V (FB, VB).
S (Spanned)Logical records can span multiple physical blocks. Used for very large variable-length records. Can be combined with V (VS, VBS).
A (ASA Control Character)The first byte of each record contains an ASA carriage control character (used primarily for printing). Can be combined with any format (FA, VA, FBA, VBA).
M (Machine Code Control Character)The first byte of each record contains a machine code control character. Can be combined with any format (FM, VM, FBM, VBM).

Common RECFM Combinations

CombinationDescriptionCommon Usage
FBFixed BlockedThe most common format for data files. Efficient storage and processing.
VBVariable BlockedUsed for data with varying record lengths, such as text files.
FBAFixed Blocked with ASAUsed for print files with fixed-length records.
VBAVariable Blocked with ASAUsed for print files with variable-length records.
UUndefinedUsed for load modules, object code, and binary data.

Example:

jcl
1
2
3
4
5
6
7
//FIXEDREC DD DSN=USER.FIXED.DATA,DISP=(NEW,CATLG,DELETE), // SPACE=(TRK,(10,5)),DCB=(RECFM=FB,LRECL=80,BLKSIZE=8000) //VARREC DD DSN=USER.VAR.DATA,DISP=(NEW,CATLG,DELETE), // SPACE=(TRK,(10,5)),DCB=(RECFM=VB,LRECL=256,BLKSIZE=6144) //PRINTRPT DD SYSOUT=A,DCB=(RECFM=FBA,LRECL=133)

Important:

When creating a new dataset, always ensure that the RECFM is appropriate for the data being written. Using the wrong record format can cause data corruption or processing errors.

LRECL (Logical Record Length)

The LRECL parameter specifies the length of the logical records in a dataset. It defines the maximum size of each record and is essential for proper data access and processing.

LRECL for Different Record Formats

The interpretation of LRECL depends on the record format (RECFM):

Record FormatLRECL MeaningNotes
F (Fixed)The exact length of each recordAll records must be exactly this length
FB (Fixed Blocked)The exact length of each recordMultiple records of this length are packed into blocks
V (Variable)The maximum length of any recordLRECL includes the 4-byte Record Descriptor Word (RDW)
VB (Variable Blocked)The maximum length of any recordLRECL includes the 4-byte RDW; blocks contain multiple variable-length records
U (Undefined)Not applicableLRECL is typically omitted for RECFM=U datasets

Special Considerations for LRECL

  • Control Characters: If the record format includes ASA or machine code control characters (RECFM=FBA or RECFM=FBM), the LRECL value must include the control character byte.
  • Variable-Length Records: For V and VB formats, LRECL must be at least 5 bytes (4 bytes for the RDW plus at least 1 byte of data).
  • Maximum Value: The maximum LRECL value depends on the system and access method but is typically 32,760 bytes for standard datasets.
  • Spanned Records: For VS and VBS formats, LRECL can exceed the block size (BLKSIZE) because records can span multiple blocks.

Examples:

jcl
1
2
3
4
5
6
7
//CARD DD DSN=USER.CARD.DATA,DISP=(NEW,CATLG,DELETE), // SPACE=(TRK,(5,1)),DCB=(RECFM=FB,LRECL=80,BLKSIZE=800) //PRINT DD SYSOUT=A,DCB=(RECFM=FBA,LRECL=133) //VARDATA DD DSN=USER.VARLEN.DATA,DISP=(NEW,CATLG,DELETE), // SPACE=(TRK,(10,5)),DCB=(RECFM=VB,LRECL=1024,BLKSIZE=6144)

Common LRECL Values:

  • 80 - Traditional card image format (fixed-length)
  • 133 - Standard print line (132 data bytes + 1 carriage control byte)
  • 256, 512, 1024, 4096 - Common values for data processing
  • 32760 - Maximum for standard access methods

BLKSIZE (Block Size)

The BLKSIZE parameter specifies the maximum length, in bytes, of a physical block on the storage device. Physical blocks are the units in which data is transferred between memory and storage devices, making BLKSIZE a critical parameter for I/O performance.

Block Size Considerations

When specifying BLKSIZE, consider the following:

  • Relationship to LRECL: For fixed-length records (RECFM=F or FB), BLKSIZE must be a multiple of LRECL. For variable-length records (RECFM=V or VB), BLKSIZE must be at least 4 bytes greater than LRECL.
  • Performance Impact: Larger block sizes generally improve I/O efficiency by reducing the number of I/O operations required to process the dataset. However, very large block sizes can increase memory usage.
  • Device Constraints: Different storage devices have different optimal block sizes. For modern disk devices, block sizes up to 32,760 bytes are supported.
  • System Determined Block Size (SDB): If BLKSIZE is omitted, the system can select an optimal block size for the device. This is recommended for most new allocations.

Block Size Formulas

Record FormatBlock Size FormulaNotes
F (Fixed)BLKSIZE = LRECLOne record per block (unblocked)
FB (Fixed Blocked)BLKSIZE = n × LRECLn is the number of records per block
V (Variable)BLKSIZE ≥ LRECL + 4Block contains one record plus Block Descriptor Word (BDW)
VB (Variable Blocked)BLKSIZE ≥ LRECL + 4Block contains multiple records plus BDW
U (Undefined)BLKSIZE = maximum block sizeNo fixed relationship to record length

Optimizing Block Size

For best performance, consider these guidelines:

  • For disk datasets, use block sizes that are half-track or full-track multiples for optimal space utilization.
  • Common optimal block sizes for disk datasets are 6144, 8192, 16384, 27648, or 32760 bytes.
  • Let the system determine block size when possible by omitting the BLKSIZE parameter for new datasets.
  • For tape datasets, larger block sizes (such as 32760) generally provide better performance.

Examples:

jcl
1
2
3
4
5
6
7
8
9
//DD1 DD DSN=USER.FIXED.DATA,DISP=(NEW,CATLG,DELETE), // SPACE=(TRK,(10,5)),DCB=(RECFM=FB,LRECL=80,BLKSIZE=8000) //DD2 DD DSN=USER.VAR.DATA,DISP=(NEW,CATLG,DELETE), // SPACE=(TRK,(10,5)),DCB=(RECFM=VB,LRECL=256,BLKSIZE=6144) //DD3 DD DSN=USER.SDB.DATA,DISP=(NEW,CATLG,DELETE), // SPACE=(TRK,(10,5)),DCB=(RECFM=FB,LRECL=80) // Note: BLKSIZE is omitted in DD3, so system will determine optimal block size

Important:

Since z/OS 1.7, System Determined Block Size (SDB) is the recommended approach. Simply omit the BLKSIZE parameter, and the system will calculate an optimal value based on the device type and other DCB parameters.

DSORG (Dataset Organization)

The DSORG parameter specifies the physical organization of a dataset. It defines how records are stored and accessed, which in turn determines the access methods that can be used with the dataset.

Dataset Organization Types

DSORG ValueOrganization TypeDescription
PSPhysical SequentialRecords are stored and accessed in sequential order. This is the simplest and most common dataset organization. Records must be accessed in sequence from beginning to end.
POPartitioned OrganizationA partitioned dataset (PDS) contains multiple members, each of which is a separate sequential dataset. Used for program libraries, source code libraries, etc. Allows for both sequential and direct access to members.
DADirect AccessRecords can be accessed directly using a key or relative record number. Allows for random access to records without reading through the entire dataset.
ISIndexed SequentialRecords are organized with an index for both sequential and direct access. Largely superseded by VSAM datasets in modern systems.
VSVSAMVirtual Storage Access Method dataset. VSAM datasets are actually defined using IDCAMS, not JCL DCB parameters.

Common Dataset Organizations

The most commonly used dataset organizations are:

  • PS (Physical Sequential): Used for most data files, reports, input/output files, and transaction logs. Records are processed in the order they appear.
  • PO (Partitioned Organization): Used for libraries containing multiple related datasets (members). Examples include source code libraries, JCL procedure libraries, and load module libraries.

Examples:

jcl
1
2
3
4
5
6
7
8
//SEQFILE DD DSN=USER.SEQDATA,DISP=(NEW,CATLG,DELETE), // SPACE=(TRK,(10,5)),DCB=(RECFM=FB,LRECL=80,BLKSIZE=8000,DSORG=PS) //PDSLIB DD DSN=USER.PDS.LIB,DISP=(NEW,CATLG,DELETE), // SPACE=(TRK,(10,5,5)),DCB=(RECFM=FB,LRECL=80,BLKSIZE=8000,DSORG=PO) //DAFILE DD DSN=USER.DIRECT.FILE,DISP=(NEW,CATLG,DELETE), // SPACE=(TRK,(10,5)),DCB=(RECFM=F,LRECL=100,BLKSIZE=100,DSORG=DA)

Best Practice:

For most JCL applications, DSORG=PS or DSORG=PO are the most common choices. DSORG can often be omitted for existing datasets as the information is stored in the dataset label. For VSAM datasets, use IDCAMS utility rather than specifying DCB parameters in JCL.

DCB Parameter Examples by File Type

Different types of files require different DCB parameters. Here are some common examples for various file types:

Standard Data Files

Fixed-Length Records:

jcl
1
2
3
//DATAFILE DD DSN=USER.DATA.FILE,DISP=(NEW,CATLG,DELETE), // SPACE=(TRK,(20,10)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=8000,DSORG=PS)

80-byte fixed-length records, blocked to improve I/O efficiency

Variable-Length Records:

jcl
1
2
3
//VARFILE DD DSN=USER.VAR.FILE,DISP=(NEW,CATLG,DELETE), // SPACE=(TRK,(30,15)), // DCB=(RECFM=VB,LRECL=1024,BLKSIZE=6144,DSORG=PS)

Variable-length records with maximum length of 1024 bytes

Print Files

Print File with ASA Control Characters:

jcl
1
2
//PRINTASA DD SYSOUT=A, // DCB=(RECFM=FBA,LRECL=133,BLKSIZE=6650)

133-byte records (132 data + 1 ASA control character) for standard line printer

Print File with Machine Control Characters:

jcl
1
2
//PRINTMCC DD SYSOUT=A, // DCB=(RECFM=FBM,LRECL=133,BLKSIZE=6650)

133-byte records with machine control characters

Program Libraries

Source Code Library (PDS):

jcl
1
2
3
//SRCLIB DD DSN=USER.SOURCE.LIB,DISP=(NEW,CATLG,DELETE), // SPACE=(TRK,(50,20,10)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=8000,DSORG=PO)

Partitioned dataset with 80-byte fixed-length records for source code

Load Module Library:

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

Partitioned dataset with undefined record format for executable load modules

Using DCB References

Instead of specifying all DCB parameters explicitly, you can reference an existing dataset's DCB information:

DCB Reference to Existing Dataset:

jcl
1
2
3
4
5
6
7
//NEWFILE DD DSN=USER.NEW.FILE,DISP=(NEW,CATLG,DELETE), // SPACE=(TRK,(20,10)), // DCB=*.OLDSTEP.OLDDD //NEWFILE2 DD DSN=USER.NEW.FILE2,DISP=(NEW,CATLG,DELETE), // SPACE=(TRK,(20,10)), // DCB=SYS1.PROCLIB

Using DCB information from a previous DD statement or existing dataset

Best Practice:

When creating multiple datasets with the same attributes, use a DCB reference rather than repeating the same parameters. This reduces the chance of errors and makes maintenance easier.

Frequently Asked Questions

Test Your Knowledge

1. Which DCB parameter specifies the format of records in a dataset?

  • LRECL
  • RECFM
  • BLKSIZE
  • DSORG

2. What does RECFM=FB indicate?

  • Fixed, Blocked records
  • Fixed, Binary records
  • Format, Blocked records
  • Format, Binary records

3. For fixed-length blocked records (RECFM=FB), what is the relationship between LRECL and BLKSIZE?

  • BLKSIZE must be equal to LRECL
  • BLKSIZE must be a multiple of LRECL
  • BLKSIZE must be at least 4 bytes greater than LRECL
  • There is no required relationship between BLKSIZE and LRECL

4. What is the standard LRECL for print files with ASA control characters?

  • 80
  • 133
  • 256
  • 132

5. What DSORG value would you use for a source code library containing multiple program files?

  • PS
  • PO
  • DA
  • IS

6. Write a JCL statement to create a new sequential dataset with fixed-length blocked records, a logical record length of 100 bytes, and an optimal block size for disk storage.