Understanding Data Control Block parameters for defining dataset characteristics in JCL
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:
12//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.
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.
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):
If a required DCB parameter is not specified in any of these sources, the job may fail with an I/O error.
The most commonly used DCB parameters are:
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.
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.
The primary record format types are:
Format | Description | Characteristics |
---|---|---|
F (Fixed) | All records have the same length |
|
V (Variable) | Records have varying lengths |
|
U (Undefined) | No specific record format |
|
RECFM can include modifiers that provide additional information about the record format:
Modifier | Description |
---|---|
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). |
Combination | Description | Common Usage |
---|---|---|
FB | Fixed Blocked | The most common format for data files. Efficient storage and processing. |
VB | Variable Blocked | Used for data with varying record lengths, such as text files. |
FBA | Fixed Blocked with ASA | Used for print files with fixed-length records. |
VBA | Variable Blocked with ASA | Used for print files with variable-length records. |
U | Undefined | Used for load modules, object code, and binary data. |
Example:
1234567//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.
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.
The interpretation of LRECL depends on the record format (RECFM):
Record Format | LRECL Meaning | Notes |
---|---|---|
F (Fixed) | The exact length of each record | All records must be exactly this length |
FB (Fixed Blocked) | The exact length of each record | Multiple records of this length are packed into blocks |
V (Variable) | The maximum length of any record | LRECL includes the 4-byte Record Descriptor Word (RDW) |
VB (Variable Blocked) | The maximum length of any record | LRECL includes the 4-byte RDW; blocks contain multiple variable-length records |
U (Undefined) | Not applicable | LRECL is typically omitted for RECFM=U datasets |
Examples:
1234567//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:
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.
When specifying BLKSIZE, consider the following:
Record Format | Block Size Formula | Notes |
---|---|---|
F (Fixed) | BLKSIZE = LRECL | One record per block (unblocked) |
FB (Fixed Blocked) | BLKSIZE = n × LRECL | n is the number of records per block |
V (Variable) | BLKSIZE ≥ LRECL + 4 | Block contains one record plus Block Descriptor Word (BDW) |
VB (Variable Blocked) | BLKSIZE ≥ LRECL + 4 | Block contains multiple records plus BDW |
U (Undefined) | BLKSIZE = maximum block size | No fixed relationship to record length |
For best performance, consider these guidelines:
Examples:
123456789//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.
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.
DSORG Value | Organization Type | Description |
---|---|---|
PS | Physical Sequential | Records 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. |
PO | Partitioned Organization | A 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. |
DA | Direct Access | Records can be accessed directly using a key or relative record number. Allows for random access to records without reading through the entire dataset. |
IS | Indexed Sequential | Records are organized with an index for both sequential and direct access. Largely superseded by VSAM datasets in modern systems. |
VS | VSAM | Virtual Storage Access Method dataset. VSAM datasets are actually defined using IDCAMS, not JCL DCB parameters. |
The most commonly used dataset organizations are:
Examples:
12345678//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.
Different types of files require different DCB parameters. Here are some common examples for various file types:
Fixed-Length Records:
123//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:
123//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 File with ASA Control Characters:
12//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:
12//PRINTMCC DD SYSOUT=A, // DCB=(RECFM=FBM,LRECL=133,BLKSIZE=6650)
133-byte records with machine control characters
Source Code Library (PDS):
123//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:
123//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
Instead of specifying all DCB parameters explicitly, you can reference an existing dataset's DCB information:
DCB Reference to Existing Dataset:
1234567//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.
1. Which DCB parameter specifies the format of records in a dataset?
2. What does RECFM=FB indicate?
3. For fixed-length blocked records (RECFM=FB), what is the relationship between LRECL and BLKSIZE?
4. What is the standard LRECL for print files with ASA control characters?
5. What DSORG value would you use for a source code library containing multiple program files?
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.