Understanding record formats and dataset attributes is essential for effective editing in ISPF. LRECL (Logical Record Length) and RECFM (Record Format) are fundamental dataset attributes that determine how data is stored and how the editor handles files. This tutorial covers fixed and variable record formats, LRECL, RECFM, and how these attributes affect editing in the ISPF editor.
Record formats and dataset attributes directly impact how you edit files. Understanding these concepts helps you work effectively with different file types, maintain proper formatting, and avoid errors related to record length and format.
Understanding Dataset Attributes
Dataset attributes define how data is organized and stored.
Key Dataset Attributes
Important dataset attributes include:
LRECL: Logical Record Length (length of each record)
RECFM: Record Format (how records are organized)
BLKSIZE: Block Size (size of physical blocks)
DSORG: Data Set Organization (PS, PO, etc.)
Why Attributes Matter
Dataset attributes matter because:
They determine how data is stored
They affect how the editor handles files
They impact file compatibility
They influence editing behavior
LRECL (Logical Record Length)
LRECL specifies the length of each logical record in bytes.
What is LRECL?
LRECL:
Stands for Logical Record Length
Specifies the length of each record in bytes
Is measured in bytes (characters)
Determines the maximum (or fixed) line length
Is a critical dataset attribute
LRECL for Fixed Format
For fixed-format files (RECFM=F or FB):
LRECL specifies the exact length of every record
All records must be exactly LRECL bytes long
Records are padded or truncated to LRECL
Common values: 80 (for source code), 132 (for wide listings)
LRECL for Variable Format
For variable-format files (RECFM=V or VB):
LRECL specifies the maximum record length
Records can be shorter than LRECL
Records cannot exceed LRECL
Each record can have a different length
Common LRECL Values
Common LRECL values include:
80: Standard for source code (COBOL, JCL, etc.)
132: Wide format for listings and reports
256: Common for data files
32760: Maximum for variable format
Other values based on specific needs
RECFM (Record Format)
RECFM specifies how records are organized in the dataset.
What is RECFM?
RECFM:
Stands for Record Format
Specifies how records are organized
Determines whether records are fixed or variable length
Indicates whether records are blocked
Affects how the editor handles the file
Common RECFM Values
Common RECFM values include:
F: Fixed (unblocked)
FB: Fixed Blocked
V: Variable (unblocked)
VB: Variable Blocked
U: Undefined
Fixed Record Format (F, FB)
Fixed format means all records have the same length.
RECFM=F (Fixed Unblocked)
RECFM=F means:
All records have exactly the same length (LRECL)
Records are not grouped into blocks
Each record is stored individually
Less efficient for storage but simpler
RECFM=FB (Fixed Blocked)
RECFM=FB means:
All records have exactly the same length (LRECL)
Records are grouped into blocks for efficiency
Multiple records per physical block
More efficient storage than unblocked
Most common for source code files
Editing Fixed Format Files
When editing fixed-format files:
All lines have the same length
You must stay within LRECL
Lines are padded or truncated to LRECL
The editor enforces the record length
BOUNDS can help stay within limits
Fixed Format Example
For a file with RECFM=FB, LRECL=80:
Every line is exactly 80 bytes
Short lines are padded with spaces
Long lines are truncated to 80 bytes
This is typical for COBOL source code
Variable Record Format (V, VB)
Variable format means records can have different lengths.
RECFM=V (Variable Unblocked)
RECFM=V means:
Records can have different lengths
Each record length is up to LRECL
Records are not grouped into blocks
Less efficient but more flexible
RECFM=VB (Variable Blocked)
RECFM=VB means:
Records can have different lengths
Each record length is up to LRECL
Records are grouped into blocks for efficiency
More efficient than unblocked variable
Common for data files with varying record lengths
Editing Variable Format Files
When editing variable-format files:
Lines can have different lengths
Each line can be up to LRECL bytes
Lines are not padded to a fixed length
The editor allows variable-length lines
You must still stay within LRECL maximum
Variable Format Example
For a file with RECFM=VB, LRECL=256:
Lines can be any length from 1 to 256 bytes
Line 1 might be 50 bytes
Line 2 might be 120 bytes
Line 3 might be 30 bytes
Each line uses only the space it needs
Understanding Blocking
Blocking groups records together for efficiency.
What is Blocking?
Blocking:
Groups multiple records into physical blocks
Improves storage and I/O efficiency
Is indicated by "B" in RECFM (FB, VB)
Does not affect logical record structure
Is transparent to the editor
Blocked vs. Unblocked
Comparison:
Blocked (FB, VB): More efficient, groups records
Unblocked (F, V): Simpler, records stored individually
Blocked is generally preferred for efficiency
Unblocked is simpler but less efficient
How Record Formats Affect Editing
Record formats directly impact how you edit files in ISPF.
Fixed Format Editing
When editing fixed-format files:
All lines appear the same length
You must stay within LRECL
Short lines are padded with spaces
Long lines are truncated
BOUNDS helps enforce limits
Column positioning is important
Variable Format Editing
When editing variable-format files:
Lines can have different lengths
Each line uses only the space it needs
You must stay within LRECL maximum
Lines are not padded
Editor allows natural line lengths
More flexible for varying content
Editor Behavior Differences
The editor may behave differently:
Display may vary between fixed and variable
Line wrapping may differ
Column positioning may be handled differently
Status line may show format information
Viewing Dataset Attributes
You can view dataset attributes in ISPF.
In the Editor
In the editor, you can see:
RECFM and LRECL in the status line
Dataset attributes in file information
Format information in editor displays
Using Data Set Utility
To view full dataset attributes:
Use Option 3.2 (Data Set Utility)
Select the dataset
View dataset information
See RECFM, LRECL, BLKSIZE, and other attributes
Common File Type Formats
Different file types typically use specific formats.
Source Code Files
Source code files typically use:
COBOL: RECFM=FB, LRECL=80
JCL: RECFM=FB, LRECL=80
Assembler: RECFM=FB, LRECL=80
REXX/CLIST: RECFM=FB, LRECL=80
Data Files
Data files may use:
Fixed-format data: RECFM=FB, LRECL varies
Variable-format data: RECFM=VB, LRECL varies
Format depends on data structure
Report Files
Report files may use:
Standard reports: RECFM=FB, LRECL=80
Wide reports: RECFM=FB, LRECL=132
Format depends on report width
Best Practices
Following best practices helps you work effectively with different record formats:
Know Your Format: Understand the RECFM and LRECL of files you're editing
Respect LRECL: Stay within LRECL limits when editing
Use BOUNDS for Fixed: Use BOUNDS to enforce limits for fixed-format files
Understand Padding: Be aware that fixed-format files pad short lines
Check Attributes: Verify dataset attributes before editing
Match Format to Purpose: Use appropriate formats for your file type
Consider Compatibility: Ensure format compatibility with downstream systems
Document Format: Document format requirements for your files
Explain Like I'm 5: Record Formats
Think of record formats like different types of boxes for storing things:
Fixed Format (F, FB) is like having boxes that are all exactly the same size. Every box is the same—if you put something small in it, you fill the rest with padding, and if you put something too big, you have to cut it to fit. It's like having uniform boxes where everything must fit the same size!
Variable Format (V, VB) is like having boxes that can be different sizes. You can have a small box for small things, a medium box for medium things, and a big box for big things—as long as nothing is bigger than the biggest box you have. It's like having flexible boxes that adjust to what you're storing!
LRECL is like the size of your boxes. For fixed boxes, it's the exact size every box must be. For variable boxes, it's the biggest size any box can be. It's like saying "all boxes must be this size" or "no box can be bigger than this size"!
RECFM is like the type of box system you're using. F means fixed-size boxes, V means variable-size boxes, and the B means the boxes are grouped together for efficiency. It's like choosing what kind of storage system you want!
So record formats are like different ways of organizing and storing your data in boxes, with rules about how big the boxes can be and whether they all have to be the same size!
Practice Exercises
Complete these exercises to reinforce your understanding of record formats:
Exercise 1: Viewing Dataset Attributes
Practice viewing attributes: use Data Set Utility to view RECFM and LRECL of different datasets, check attributes in the editor status line, and identify the format of various files. Build familiarity with dataset attributes.
Exercise 2: Editing Fixed Format Files
Practice editing fixed-format files: open a fixed-format file (RECFM=FB, LRECL=80), observe how all lines are the same length, practice staying within LRECL, and understand how padding works. Learn fixed-format editing.
Exercise 3: Editing Variable Format Files
Practice editing variable-format files: open a variable-format file (RECFM=VB), observe how lines can have different lengths, practice editing lines of varying lengths, and understand variable-format behavior. Learn variable-format editing.
Exercise 4: Understanding LRECL
Practice understanding LRECL: work with files of different LRECL values (80, 132, 256), observe how LRECL affects editing, practice staying within limits, and understand the relationship between LRECL and editing. Master LRECL concepts.
Exercise 5: Format Comparison
Practice comparing formats: edit both fixed and variable format files, compare editing behavior, understand the differences, and identify when to use each format. Build comprehensive understanding.
Test Your Knowledge
1. What does LRECL stand for?
Logical Record Length
Line Record Length
Long Record Length
Last Record Length
2. What does RECFM stand for?
Record Format
Record Form
Record File Mode
Record File Method
3. What is the difference between fixed and variable record formats?
Fixed has variable lengths, Variable has fixed lengths
Fixed has fixed lengths, Variable has variable lengths
They are identical
Fixed is faster
4. What does RECFM=FB mean?
Variable Blocked
Fixed Blocked
Fixed Binary
Variable Binary
5. How does RECFM affect editing?
It does not affect editing
It determines how records are handled and displayed