Chapter 30: Exercises – z/OS Dataset Concepts and Storage Management
These exercises progress through five tiers of cognitive complexity. Detailed solutions are provided for exercises 1–3, and hints are given for exercises 4–5. All remaining exercises include only the problem statement so you can practice independently.
Tier 1 — Recall
Exercise 1: Dataset Organization Types
Problem: Identify the dataset organization for each description below.
| Description | Organization |
|---|---|
| Records accessed sequentially, one after another | ? |
| Contains named members, each a separate entity | ? |
| Records accessed by a primary key via an index | ? |
| Records accessed by their relative position number | ? |
| Records stored in entry order without a key | ? |
| A byte-addressable dataset with no record structure | ? |
Choose from: PS (Physical Sequential), PO (Partitioned), KSDS, RRDS, ESDS, LDS.
Solution
| Description | Organization | |-------------|-------------| | Records accessed sequentially, one after another | PS (Physical Sequential) | | Contains named members, each a separate entity | PO (Partitioned) | | Records accessed by a primary key via an index | KSDS (Key-Sequenced Data Set) | | Records accessed by their relative position number | RRDS (Relative Record Data Set) | | Records stored in entry order without a key | ESDS (Entry-Sequenced Data Set) | | A byte-addressable dataset with no record structure | LDS (Linear Data Set) |Exercise 2: Record Format Codes
Problem: For each record format code, state the full name and describe how records are stored.
- FB
- VB
- FBA
- VBA
- U
Solution
1. **FB — Fixed Blocked**: All records have the same length (LRECL). Multiple records are grouped into a single physical block. Each block contains `BLKSIZE / LRECL` records. 2. **VB — Variable Blocked**: Records have varying lengths, each prefixed with a 4-byte Record Descriptor Word (RDW) indicating the record length. Multiple variable-length records are grouped into blocks, each prefixed with a 4-byte Block Descriptor Word (BDW). 3. **FBA — Fixed Blocked with ASA Control Characters**: Same as FB, but the first byte of each record is an ASA (American Standards Association) carriage control character for print formatting (e.g., `'1'` for new page, `' '` for single space, `'0'` for double space). 4. **VBA — Variable Blocked with ASA Control Characters**: Same as VB, but with ASA carriage control characters as the first data byte after the RDW. 5. **U — Undefined**: Records have no defined structure. Each block is treated as a single entity whose length is determined by the actual data written. Commonly used for load modules and object decks.Exercise 3: LRECL and BLKSIZE Calculation
Problem: A dataset has RECFM=FB and LRECL=150. Calculate the optimal BLKSIZE if the target block size should not exceed 27,998 bytes (half-track blocking on a 3390 DASD). How many records fit in each block?
Solution
For FB records, BLKSIZE must be a multiple of LRECL. 1. **Calculate maximum records per block:** 27,998 / 150 = 186.65 Round down to 186 records per block. 2. **Calculate BLKSIZE:** 186 x 150 = 27,900 3. **Verify:** 27,900 <= 27,998 (fits within half-track) **Answer:** BLKSIZE = 27,900 with 186 records per block. For VB records, the calculation differs. BLKSIZE must accommodate the 4-byte BDW plus multiple records, each with a 4-byte RDW. For VB with LRECL=150: the maximum record size including RDW is 150 bytes, and BLKSIZE must be at least LRECL + 4 = 154 bytes. A common practice is to set BLKSIZE = 27,998 and let the system pack as many variable-length records as will fit.Exercise 4: Dataset Naming Conventions
Problem: List five rules that govern z/OS dataset names. For each rule, give an example of a valid name and an invalid name that violates the rule.
Hint
Think about total length limits, qualifier length limits, allowed characters, the first character of each qualifier, and how qualifiers are separated. Also consider what role the high-level qualifier (HLQ) plays in dataset security and catalog management.Exercise 5: GDG Concepts
Problem: Define what a Generation Data Group (GDG) is and explain the meaning of the following GDG-relative references: (0), (+1), (-1). What is a GDG base, and what parameter controls how many generations are retained?
Hint
Think of a GDG as a collection of chronologically ordered datasets sharing the same base name. The relative references are used within JCL to address the current, next, and previous generations. The LIMIT parameter on the GDG base definition controls retention.Tier 2 — Understand
Exercise 6: PS vs. PO — When to Use Each
Explain the differences between Physical Sequential (PS) and Partitioned Organization (PO) datasets. For each of the following use cases, recommend which organization is more appropriate and justify your answer:
- Storing daily transaction records produced by a batch job.
- Storing a library of COBOL copybooks used by 50 programs.
- Storing a single flat file extract sent to an external trading partner.
- Storing multiple JCL procedures used across a department.
Exercise 7: VB vs. FB Trade-offs
A financial application processes customer correspondence records that vary in length from 80 bytes (short notices) to 2,000 bytes (detailed statements). The average record length is 400 bytes. The file contains 5 million records.
Compare the storage requirements and I/O characteristics of storing this file as RECFM=FB (LRECL=2000) versus RECFM=VB (LRECL=2004). Which is more appropriate and why?
Exercise 8: Understanding the VTOC and Catalog
Explain the relationship between the VTOC (Volume Table of Contents) and the z/OS catalog system. What information does each contain, and why are both needed? What happens when a dataset is cataloged versus uncataloged?
Exercise 9: SMS Storage Classes
A storage administrator has configured the following SMS classes:
| Storage Class | Description |
|---|---|
| STANDARD | Standard DASD, no performance guarantees |
| FAST | High-performance DASD, guaranteed response time |
| COMPRESS | Extended-format datasets with hardware compression |
| BACKUP | Lower-tier storage with automatic backup |
For each of the following datasets in a banking application, recommend the most appropriate storage class and explain your reasoning:
- Online account master VSAM KSDS (accessed by CICS)
- Monthly statement archive sequential file
- Intra-day work files used during batch processing
- Audit trail log written by security monitoring
Exercise 10: DD Statement Parameters Deep Dive
Explain the purpose and interaction of the following DD statement parameters. For each, provide a brief JCL example:
DISP=(status,normal-disposition,abnormal-disposition)SPACE=(unit,(primary,secondary,directory))DCB=(RECFM=xx,LRECL=nnn,BLKSIZE=nnn)VOL=SER=volumeDATACLAS=classname
Tier 3 — Apply
Exercise 11: Designing Dataset Allocations for a Banking System
A new banking application requires the following files. For each, write the complete DD statement with appropriate DCB, SPACE, and DISP parameters:
- Daily Transaction Input — Sequential file, fixed-length 200-byte records, expected volume 2 million records per day.
- Account Master — VSAM KSDS, variable records 100–500 bytes, 10 million accounts, 12-byte key starting at offset 0.
- Report Output — Sequential print file, FBA records 133 bytes, approximately 50,000 lines per report.
- Work File — Temporary sequential file, FB 300-byte records, deleted at end of job.
- Error Log — Sequential file, VB records up to 500 bytes, unpredictable volume.
Exercise 12: GDG Definition and Usage
Write the complete JCL and IDCAMS commands to:
- Define a GDG base named
BANK.PROD.DAILYBALwith a limit of 30 generations. - Create a new generation (
+1) using IEFBR14 with RECFM=FB, LRECL=250. - Write a COBOL
SELECTstatement andFDentry that references the current generation(0). - Write JCL that reads the previous generation
(-1)and the current generation(0)as inputs to a comparison program.
Exercise 13: Calculating Space Requirements
A bank's general ledger system produces a daily extract file with the following characteristics:
- Record format: FB
- Record length: 400 bytes
- Expected daily volume: 1.5 million records
- Growth rate: 10% per year
- Retention: 7 daily files (GDG with LIMIT 7)
Calculate: 1. The optimal BLKSIZE for a 3390 DASD device (track capacity approximately 56,664 bytes). 2. The number of tracks needed for one day's data. 3. The number of cylinders needed (15 tracks per cylinder on 3390). 4. Appropriate primary and secondary space allocations. 5. Total DASD space consumed by the GDG at full retention.
Exercise 14: VSAM Cluster Design
Design the IDCAMS DEFINE CLUSTER for a VSAM KSDS that stores insurance policy records with the following requirements:
- Policy number: 15-byte alphanumeric key at offset 0
- Average record size: 800 bytes
- Maximum record size: 2,500 bytes
- Initial load: 500,000 records
- Expected daily growth: 200 new records
- Access pattern: 80% random reads, 15% sequential browse, 5% updates
- Availability: 24x7 online access via CICS
Include appropriate FREESPACE, SHAREOPTIONS, BUFFERSPACE, and CONTROLINTERVALSIZE parameters with justification for each value chosen.
Exercise 15: Multi-Volume Dataset Allocation
An insurance company must store a claims history file that spans multiple DASD volumes. The file is RECFM=VB, LRECL=32756, and is expected to contain 50 million records with an average length of 1,200 bytes. Write the JCL DD statement for this multi-volume allocation, explaining your choices for SPACE, VOL, and DSNTYPE parameters.
Exercise 16: Migrating from PDSE to PDS
A development team has been informed that their PDSE (DEV.COBOL.SOURCE) must be converted back to a PDS due to compatibility requirements with an older utility. The PDSE contains 350 members with total data of approximately 40 MB. Write the JCL to:
- Allocate a new PDS with appropriate space and directory blocks.
- Copy all members from the PDSE to the new PDS using IEBCOPY.
- Rename the datasets so the new PDS takes the original name.
Exercise 17: DD Statement for COBOL File I/O
Write the COBOL SELECT, FD, and JCL DD statement for each of the following file types in a financial application:
- An input sequential file with 250-byte fixed records.
- An output report file with ASA carriage control.
- A VSAM KSDS accessed randomly by account number.
- A work file used for intermediate sorting within the COBOL program.
Include the complete ENVIRONMENT DIVISION and DATA DIVISION entries.
Tier 4 — Analyze
Exercise 18: Diagnosing Space Abends
A production batch job abends with S B37-04 on the third step. The failing DD statement is:
//TRANOUT DD DSN=BANK.PROD.TRANSACT,
// DISP=(NEW,CATLG,DELETE),
// SPACE=(CYL,(100,20)),
// DCB=(RECFM=FB,LRECL=200,BLKSIZE=27800)
The job processes 12 million 200-byte records. Analyze:
- Why did the space allocation fail? Calculate the space actually needed.
- What changes to the DD statement would prevent the abend?
- What SMS-managed storage features could help avoid this type of failure in the future?
- How would switching to a multi-volume allocation help?
Exercise 19: VSAM Performance Analysis
A CICS application accessing a VSAM KSDS shows response times of 500ms for random reads, far exceeding the 50ms target. The LISTCAT output shows:
RECORDS-TOTAL ----------- 2,500,000
SPLITS-CI --------------- 450,000
SPLITS-CA --------------- 12,000
EXTENTS ---------------- 127
FREESPACE-CI% ----------- 0
FREESPACE-CA% ----------- 0
CI-SIZE-DATA ----------- 4,096
CI-SIZE-INDEX ---------- 2,048
BUFFERS-DATA ----------- 2
BUFFERS-INDEX ---------- 1
Identify at least five problems revealed by this data and propose specific corrective actions for each.
Exercise 20: GDG Management Challenges
A production support team encounters the following issues with a GDG named CORP.FINANCE.GLEXTRACT (LIMIT 10):
- Generation G0045V00 is accidentally deleted; downstream jobs referencing
(-3)now point to the wrong data. - A job creating
(+1)abends, but the new generation was partially cataloged. - The GDG has reached 127 extents on its current volume, and new generations cannot be allocated.
- An auditor requests access to generation G0032V00, which has already rolled off.
Analyze each situation: explain what went wrong, what immediate recovery actions are available, and what preventive measures should be implemented.
Exercise 21: Comparing Dataset Organizations for a New Application
A financial services company is designing a new loan origination system. The main data entity is a loan application record (average 1,500 bytes, maximum 5,000 bytes) with the following access patterns:
- Batch load of 10,000 new applications nightly
- Online random retrieval by application ID (12-byte key) — 50,000 reads/day
- Sequential scan by status code for workflow processing — 5 times daily
- Updates to status and notes fields — 20,000 updates/day
Analyze the suitability of each dataset organization (PS, PO, KSDS, ESDS, RRDS) for this workload. Recommend the best organization and justify your choice with specific technical reasoning.
Exercise 22: Catalog Structure Analysis
The following datasets exist across a banking system:
BANK.PROD.ACCTMSTR (VSAM KSDS, Volume VOL001)
BANK.PROD.ACCTMSTR.BACKUP (PS, Volume VOL002)
BANK.PROD.TRANFILE (PS, Volume VOL001)
BANK.PROD.TRANFILE.BACKUP (PS, Volume VOL003)
BANK.TEST.ACCTMSTR (VSAM KSDS, Volume VOL004)
BANK.TEST.TRANFILE (PS, Volume VOL004)
A systems programmer mistakenly deletes the user catalog alias for BANK. Analyze the impact: Which datasets are affected? Can they be accessed by volume serial? What recovery steps are needed? How can this be prevented?
Exercise 23: Block Size Optimization Analysis
A performance analyst discovers that three critical batch files have suboptimal block sizes:
| File | RECFM | LRECL | Current BLKSIZE | Records | Purpose |
|---|---|---|---|---|---|
| A | FB | 80 | 80 | 10M | Source extract |
| B | VB | 500 | 504 | 5M | Transaction log |
| C | FB | 2000 | 2000 | 1M | Report detail |
Calculate the current I/O count for each file, propose optimal block sizes, calculate the new I/O count, and determine the percentage improvement. Explain the impact on elapsed time for a batch window.
Tier 5 — Create
Exercise 24: Enterprise Dataset Standards Document
Design a comprehensive dataset standards document for a large bank with 5,000 batch jobs. The document should cover:
- Naming conventions with templates for each environment (production, test, development, disaster recovery).
- Record format and block size standards for sequential files, PDSEs, and VSAM datasets.
- Space allocation guidelines based on record count and record length.
- GDG standards including naming, limits, and retention policies.
- SMS class assignments by dataset type and criticality.
- Security requirements by dataset name pattern (integration with RACF).
Provide the full standards document with specific examples for banking datasets (accounts, transactions, loans, reports, work files).
Exercise 25: Automated Dataset Capacity Planning Tool
Design a COBOL program and supporting JCL that serves as a dataset capacity planning tool. The program should:
- Accept parameters for record format, record length, record count, and growth rate.
- Calculate optimal block size for 3390 DASD.
- Calculate space requirements in tracks, cylinders, and megabytes.
- Project space needs for 1, 3, 6, and 12 months based on growth rate.
- Recommend primary and secondary allocations.
- Produce a formatted report with all calculations.
Write the complete COBOL program, the JCL to compile and run it, and include sample input and expected output.
Exercise 26: VSAM Health Monitoring System
Design a batch job stream that monitors the health of all critical VSAM clusters in a banking environment. The system should:
- Run IDCAMS LISTCAT against each cluster and capture key metrics.
- Use DFSORT to extract and format the metrics into a monitoring report.
- Flag clusters with: CI split ratio > 10%, CA splits > 0, freespace < 5%, extents > 50.
- Produce a prioritized reorganization schedule.
- Generate the IDCAMS REPRO/DELETE/DEFINE/REPRO commands needed for each flagged cluster.
Write the JCL, IDCAMS commands, DFSORT control statements, and a COBOL program to analyze the LISTCAT output and produce recommendations.
Exercise 27: Cross-Platform Data Exchange Framework
A bank needs to exchange data daily with three external partners using different formats:
- Partner A: Fixed-width EBCDIC file (FB, LRECL=500) via Connect:Direct
- Partner B: CSV file (VB, maximum 2000 bytes) via SFTP
- Partner C: XML file (VB, maximum 32000 bytes) via MQ
Design the complete dataset infrastructure including:
- Dataset naming conventions for inbound and outbound files.
- Staging area dataset definitions with appropriate DCB attributes.
- GDG structures for archival.
- JCL for each partner's send/receive process.
- DFSORT steps for format conversion (EBCDIC to ASCII, fixed to delimited).
- Error handling for missing or malformed files.
Write all JCL, DFSORT control statements, and COBOL program stubs for validation.
Exercise 28: Disaster Recovery Dataset Strategy
Design a disaster recovery strategy for a bank's critical datasets. The environment includes:
- 500 VSAM KSDS clusters (online account data)
- 2,000 sequential files (batch processing)
- 100 GDGs with various retention periods
- 50 PDSEs (source code, JCL, copybooks)
Your design must cover:
- Backup frequency and methods for each dataset type.
- Off-site replication strategy.
- Recovery Time Objective (RTO) and Recovery Point Objective (RPO) targets.
- JCL procedures for full and incremental recovery.
- Catalog recovery procedures.
- Testing and validation of the DR plan.
Write the key JCL procedures, IDCAMS commands, and a recovery runbook outline.
Exercise 29: Storage Management Automation Suite
Create an automated storage management suite that runs weekly and performs:
- Identifies datasets not accessed in 90 days using DCOLLECT data.
- Produces a report of space usage by high-level qualifier.
- Identifies GDGs that have exceeded their intended retention and recommends cleanup.
- Detects datasets with suboptimal block sizes and generates correction JCL.
- Monitors DASD volume utilization and alerts when volumes exceed 85% capacity.
Write the JCL for the DCOLLECT extract, DFSORT processing for each report, and a COBOL program to analyze the data and produce recommendations.
Exercise 30: Dataset Migration for Application Modernization
A bank is modernizing a 30-year-old COBOL application. The current system uses:
- 15 flat files (PS) with packed decimal fields
- 8 VSAM KSDS clusters with COMP-3 balances
- 3 GDGs for daily processing
The new system requires:
- All numeric fields converted from packed decimal to zoned decimal for readability
- Record layouts expanded to include new fields (email, mobile phone)
- VSAM clusters reorganized with new key structures
- Historical data preserved with full audit trail
Design the complete migration plan including: data mapping documents, conversion JCL using DFSORT for field reformatting, IDCAMS commands for VSAM restructuring, validation procedures to ensure data integrity, and rollback procedures in case of failure. Write all JCL, DFSORT control statements, and COBOL validation program logic.