Monday, 28 July 2014

How z/OS Stores COBOL Data Sets on DASD

A COBOL program writes an 80-byte logical record; QSAM can combine many such records into one block; z/OS places the block in CKD or ECKD track format inside an allocated extent. That path is more useful than picturing the application selecting a disk sector.

COBOL data storage on z OS DASD from logical records through blocks tracks and extents
COBOL sees logical records; z/OS access methods and storage services map them to DASD space.

The storage path from COBOL to DASD

  1. The program reads or writes a logical record described by its FD and record layout.
  2. An access method such as QSAM buffers records and can group them into blocks.
  3. The blocks are recorded on CKD or ECKD tracks assigned to the data set.
  4. Tracks belong to one or more extents on a DASD volume.
  5. The volume table of contents records data-set and extent information; a catalog can map the data-set name to its volume.
Application boundary: ordinary COBOL sequential I/O addresses records through an access method. The program does not calculate cylinder, head, and record addresses for each WRITE.

Key z/OS DASD terms

TermMeaningWhat the developer sees
Logical recordThe application data unit.LRECL, RECFM, and the COBOL record description.
BlockA non-VSAM recording unit that can hold one or more logical records.BLKSIZE; QSAM normally handles blocking and unblocking.
TrackA CKD/ECKD recording area containing record 0 and data records or blocks.Allocation and diagnostic tools report track use.
CylinderA fixed group of tracks on a CKD device.SPACE=(CYL,...) requests space in cylinder units.
ExtentA contiguous area allocated or reserved for one data set.Primary space forms the initial allocation; secondary requests add extents.
VolumeA logical DASD volume identified by a volume serial.VOLSER, storage class, catalog, and VTOC information.

CKD and ECKD track format

IBM documents DASD tracks in count-key-data or extended count-key-data format. Each track contains record 0 and data records. A count area identifies a block's cylinder, head, record number, and data length. A hardware key area is optional; most application data uses count-data format, while VSAM uses software keys inside its own structures.

Hardware documentation may call a unit on the track a record, while z/OS software documentation often calls it a block and reserves “record” for the logical application record. Confirm which layer a manual is describing before comparing sizes.

Logical records and blocks

For a fixed blocked sequential data set, RECFM=FB means each logical record has the same length and a block contains an integral number of records. With LRECL=80 and BLKSIZE=0, z/OS selects a suitable system-determined block size.

//OUTFILE DD DSN=USER1.DAILY.REPORT, // DISP=(NEW,CATLG,DELETE), // UNIT=SYSDA, // SPACE=(CYL,(5,2),RLSE), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=0)

The job requests five cylinders initially and two cylinders for each secondary allocation. RLSE asks z/OS to release eligible unused space when the data set is closed. The blocked versus unblocked records guide explains blocking-factor calculations and system-determined BLKSIZE.

Primary space, secondary space, and extents

The primary quantity is the initial space request. When it fills, z/OS can obtain the secondary quantity as another extent, subject to volume space and the extent limit for that data-set type. Extents let a data set grow without requiring one preallocated continuous area for its maximum possible size.

Repeated small secondary allocations can create many extents and eventually hit a format limit. A failed allocation or extension should be diagnosed from allocation messages, volume free space, SMS class rules, and the data set's current extent count rather than from COBOL source alone.

What the VTOC and catalog do

The VTOC holds control-block information for data sets and free space on a volume, including extent locations and attributes such as DSORG, RECFM, LRECL, and BLKSIZE. The catalog serves a different lookup purpose: it associates a cataloged data-set name with the volume or storage information needed to locate it.

Do not merge the concepts: cataloging a data set does not store its records in the catalog. The VTOC and catalog contain metadata; the data blocks occupy allocated DASD extents.

VSAM uses control intervals and control areas

The record-to-block explanation applies directly to non-VSAM access methods such as QSAM. VSAM organizes records in control intervals, with control intervals grouped into control areas. A control interval can occupy one or more contiguous DASD blocks. Use IDCAMS DEFINE and LISTCAT for VSAM allocation and catalog inspection, and the COBOL indexed-file guide for application access.

PDS and PDSE storage differs

A PDS contains a fixed-size directory and members, and deleted member space is not automatically reclaimed until compression. A PDSE has a managed, expandable directory and automatically reuses space from deleted or replaced members. PDSE processing can also reblock logical records when writing to DASD, so the block size observed by an application need not be the original physical block size.

Modern DASD is often virtualized

z/OS applications continue to use logical CKD/ECKD volumes, tracks, cylinders, and extents. The storage controller can map those logical constructs onto RAID arrays, flash, caches, and replicated storage. Rotational speed and literal platter geometry are therefore poor application assumptions.

The separate COBOL disk-I/O guide follows a READ or WRITE through QSAM, buffers, access methods, the channel subsystem, and storage cache. This page owns the on-volume layout and allocation model.

How to inspect a data set

  • Use ISPF 3.4 or LISTDS to view DSORG, RECFM, LRECL, BLKSIZE, volume, and allocation information for non-VSAM data sets.
  • Use IDCAMS LISTCAT for VSAM cluster, component, control-interval, and allocation details.
  • Check job allocation messages when primary or secondary space cannot be obtained.
  • Match the data-set attributes to the COBOL FD and record layout; the fixed versus variable record guide covers FB and VB choices.
  • For field-level layout questions, use the COBOL record-description guide.

Common storage-model mistakes

  • Equating a COBOL record with a DASD block: several records can share one block, and a spanned record can cross blocks.
  • Calling DASD units PC sectors: supported z/OS interfaces describe CKD/ECKD tracks, records or blocks, cylinders, and extents.
  • Assuming BLKSIZE equals track capacity: device format and per-block overhead affect track use.
  • Treating the catalog as the data store: it supplies location metadata, not the application records.
  • Applying QSAM blocking terms directly to VSAM: VSAM uses control intervals and control areas.

Official IBM references

Frequently asked questions

Does COBOL write directly to a DASD track?

Usually no. A COBOL program works with logical records through an access method such as QSAM or VSAM. z/OS and the access method perform buffering, blocking, and device I/O.

What is the difference between a record and a block?

A logical record is the application unit described by LRECL and RECFM. A non-VSAM block is the physical recording and transfer unit that can contain one or more logical records.

What is a DASD extent?

An extent is a contiguous area of tracks, cylinders, or blocks allocated or reserved for a data set on a DASD volume. Secondary allocations add extents as the data set grows.

Are modern mainframe disks still physical CKD platters?

z/OS continues to use CKD or ECKD addressing and allocation concepts, but enterprise storage systems can virtualize the logical volumes over internal disk or flash. Applications should use z/OS data-set attributes rather than assume a physical platter layout.

Working rule: diagnose storage from the logical record, access method, block or control interval, allocation, and volume metadata layers—in that order.

No comments:

Post a Comment

New In-feed ads