Count key data
Count key data (CKD) is a direct access storage device (DASD)[a] data recording format introduced in 1964 by IBM with its IBM System/360 and still in current use on IBM mainframes. It is a self-defining format with each data record represented by a Count Area that identifies the record and provides the number of bytes in an optional Key Area and an optional Data Area. This is in contrast to devices using fixed sector size or a separate format track.
Count key data (CKD) also refers to the set of channel commands (collectively Channel Command Words, CCWs) that are generated by an IBM mainframe for use with a DASD subsystem employing the CKD recording format. The initial set of CKD CCW introducted in 1964 was substantially enhanced and improved into the 1990s.
CKD Track Format
The principle of CKD records is that since data record lengths can vary, they all have an associated count field which identifies the record and indicates the size of the key (if used) and the size of the data area, if used.[b] The count field has the identification of the record[c] in cylinder-head-record format, the length of the key, and the length of the data. The key may be omitted or consist of a string of characters.
Each CKD record consists of a count field, an optional key field, and an optional[d] "user" data field with error correction/detection information appended to each field and gaps separating each field. Because of the gaps and other information, the recorded space is larger than that required for just the count data, key data, or user data.
Most often, the key is omitted, the record located sequentially or by direct cylinder-head-record addressing. If it is present, the key is typically a copy of the first n bytes of the data record (for "unblocked" records, or a copy of the highest key in the block, for "blocked" records), but can be any data which will be used to find the record, usually using the Search Key Equal or Search Key High or Equal CCW. The key (and hence the record) is locatable via hardware commands.[page needed] Since the introduction of IBM's System/360 in 1964, nearly all IBM large and intermediate system DASDs have used the count key data record format.[page needed]
The advantages of count key data record format are:
- The record size can be exactly matched to the application block size
- CPU and memory requirements can be reduced by exploiting search-key commands.
- IBM CKD subsystems initially operated synchronously with the system channel and can process information in the gaps between the various fields, thereby achieving higher performance by avoiding the redundant transfer of information to the host. Both synchronous and asynchronous operations are supported on later subsystems.
Reduced CPU and memory prices and higher device and interface speeds have somewhat nullified the advantages of CKD, and it is retained only because IBM's flagship operating system z/OS does not support sector-oriented interfaces.
Originally CKD records had a one-to-one correspondence to a physical track of a DASD device; however over time the records have become more and more virtualized such that in a modern IBM mainframe there is no longer a direct correspondence between the a CKD record ID and a physical layout of a track.
IBM's CKD DASD subsystems
Access by IBM mainframes to CKD records is controlled by CKD CCWs (Channel Command Words), a subset of the mainframe's I/O instructions.
Beginning with its 1964 System/360 announcement IBM's mainframes have accessed input/output (I/O) devices, such as DASD, through channels and the associated control units (SCU or Storage Control Unit). Initially there was a high degree of correspondence between the logical view of such accesses and the actual hardware, as shown in the illustration to the right. Systems generally addressed devices as three hexadecimal digits, one each for Channel, Control Unit and Device, with three digit labels typically affixed[e] to identify the specific device.
On low end systems the Channel and the Control Unit were frequently physically integrated but remained logically separate. IBM's New Attachment Strategy beginning with the 3380 Model 2 in 1972 physically separated the SCU into two physical entities, a Director and a Controller while keeping them logically the same. The Controller handles the CKD track formatting and is packaged with the first drive(s) in a string of drives and having a model number with the letter "A" as a prefix, an "A Box" as in 3350 Model A2 containing a controller and two drives. The combination of an SCU and a DASD or a Director and an A Box is called a subsystem.
Modern IBM mainframes allow two hexadecimal digits for channels and are physically highly virtualized.
Access to specific classes of I/O devices by an IBM mainframe is under the control of Channel Command Words ("CCW")s, some of which are generic (e.g. No Operation) but many of which are specific to the type of I/O device (e.g. Read Backwards for a tape drive). The group of CCWs defined by IBM for DASD fall into five broad categories:
- Control – control of the DASD including the path thereto
- Sense – sense status of the DASD including the path thereto; some sense commands affect the status of the controller and DASD in a fashion more in keeping with a control command, e.g., RESERVE, RELEASE
- Write – write information to the controller or DASD (which may be buffered or cached in the path)
- Search – compare information from the CPU with information stored in the DASD.
- Read – read information from the DASD (which may be buffered or cached in the path)
CKD CCWs are the specific set of CCWs used to access CKD DASD subsystems. This is in contrast to fixed block architecture (FBA) CCWs which are used to access FBA DASD subsystems.
CKD Track Format is the track format for DASD as initially announced in 1964 and offered by IBM and plug compatible competitors in DASD products until at least 1996 (2301 to 3390 Model 9); in total 22 unique[f] DASD offered by IBM configured in at least 35 different subsystem configurations. Plug-compatible offered many of the same DASD including 4 CKD subsystms featureing unique DASD.[g]
Initial CKD implementation
In its 1964 implementation of CKD track format on IBM's System/360 IBM offered five DASDs attached via two SCUs to the system's high speed Selector Channel. The 2820 SCU controlled the 2301 Drum while the 2841 SCU controlled combinations of the 2302 Disk Storage, 2311 Disk Drive, 2321 Data Cell and/or 7320 Drum Storage. IBM quickly replaced the 7320 with the faster and larger 2303.The 2314 DASF[h] and 2844 SCU were added in 1965. Forty one CCWs were implemented to control these DASD as follows:
|Set File Mask||S||S||S||S||S||S||S||1F||1|
|Search||Home Address EQ||S||S||S||S||S||S||S||39||B9||4 (usually)|
|Identifier EQ||S||S||S||S||S||S||S||31||B1||5 (usually)|
|Identifier HI||S||S||S||S||S||S||S||51||D1||5 (usually)|
|Identifier EQ or HI||S||S||S||S||S||S||S||71||FI||5 (usually)|
|Key EQ||S||S||S||S||S||S||S||29||A9||1 to 255|
|Key HI||S||S||S||S||S||S||S||49||C9||1 to 255|
|Key EQ or HI||S||S||S||S||S||S||S||69||E9||1 to 255|
|Key & Data EQ||O||O||O||S||2D||AD||See Note 2|
|Key & Data HI||O||O||O||S||4D||CD||See Note 2|
|Key & Data EQ or HI||O||O||O||S||6D||ED||See Note 2|
|Continue Scan||Search EQ||O||O||O||S||25||A5||See Note 2|
|(see Note 1)||Search HI||O||O||O||S||45||C5||See Note 2|
|"||Search HI or EQ||O||O||O||S||65||E5||See Note 2|
|"||Set Compare||O||O||O||S||35||B5||See Note 2|
|"||Set Compare||O||O||O||S||75||F5||See Note 2|
|"||No Compare||O||O||O||S||55||D5||See Note 2|
|Record 0||S||S||S||S||S||S||S||16||96||Number of bytes transferred|
|Key & Data||S||S||S||S||S||S||S||0E||8E|
|Count. Key & Data||S||S||S||S||S||S||S||1E||9E|
|Write||Home Address||S||S||S||S||S||S||S||19||5 (usually)|
|Record 0||S||S||S||S||S||S||S||15||8*KL*DL of RO|
|Count, Key & Data||S||S||S||S||S||S||S||1D||8+KL+DL|
|Special Count, Key & Data||S||S||S||S||S||S||S||01||8+KL+DL|
|Key & Data||S||S||S||S||S||S||S||0D||KL*DL|
- O = optional feature
- S = standard feature
- MT = multitrack: when supported CCW will continue to operate on next heads in sequence to end of cylinder
- ‡ = TIC (Transfer In Channel) and other standard commands not shown.
- † = code same as MT Off except as listed
- 1. File Scan Feature (9 CCWs) only available on 2841 for 2302, 2311 and 2321; they were not available on subsequent DASD controllers for their DASD.
- 2. Count is number of bytes in search argument, including mask bytes
This initial implementation included the following capabilities which were continued in subsequent embodiments.
- Defective/Alternative Track – enables an alternate tract to replace a defective track transparent to the access method in use.
- Record overflow – records can exceed the maximum track length of a DASD
- Multitrack operations – specific CCWs can continue onto the next sequential head
- Command chaining – CCWs could be chained together to construct complex channel programs. The gaps in a CKD track format provided sufficient time between the commands so that all channel and SCU activity necessary to complete a command can be performed in the a gap between appropriate fields. Such programs can search a large amount of information stored on a DASD, upon successful completion returning only the desired data and thereby freeing CPU resources for other activity.
- Channel switching – an SCU can be shared between channels - initially two channel switching was provided and it was expanded to up to eight channels in later SCUs. The channels can be on the same or different CPUS.
The following example for a channel program reads a disk record identified by a Key field. The track containing the record and the desired value of the key is known. The SCU will search the track to find the requested record. In this example <> indicate that the channel program contains the storage address of the specified field.
SEEK <cylinder/head number> SEARCH KEY EQUAL <key value> TIC *-8 Back to search if not equal READ DATA <buffer>
The TIC (transfer in channel) will cause the channel program to branch to the SEARCH command until a record with a matching key (or the end of the track) is encountered. When a record with a matching key is found the SCU will include Status Modifier in the channel status, causing the channel to skip the TIC CCW; thus the channel program will not branch and the channel will execute the READ command.
Rotational Position Sensing
Rotational position sensing (RPS) was introduced in storage control units beginning in 1971 with the 2835 Control Unit and associated 2305 DASD, It required a block multiplexor channel. Two new CCWs, SET SECTOR and READ SECTOR enabled the channel to issue a seek to an angular track position. RPS permits channel disconnection during most of the rotational delay period and thus contributes to increased channel utilization. The control unit implements RPS by dividing each track into equal angular segments.
The block multiplexor channel also provides disconnection for Seek commands in all subsequent DASD control units.
The following example channel program will format a track with an R0 and three CKD records.
SEEK <cylinder/head number> SET FILE MASK <allow write operatons> SET SECTOR <sector number=0> WRITE R0 <cylinder/head/R0, key length=0, data length=6> WRITE CKD <cylinder/head/R1, key length, data length> WRITE CKD <cylinder/head/R2, key length, data length> WRITE CKD <cylinder/head/R3, key length, data length>
In this example the Record 0 conforms to IBM programming standards. With a block multiplexer channel the channel is free during the time the DASD is seeking and again while the disk rotates to beginning of the track. A selector channel would be busy for the entire dutation of this sample program.
Defect skipping allows data to be written before and after one of more surface defects[i] allowing all of a track to be used except for that portion that has the defect. This also eliminates the time that was formerly required to seek to an alternate track. Only a limited number of defects could be skipped so alternate tracks remained supported for those tracks with excess defects.
Defect skipping was introduced in 1974 with the 3340 attached via the 3380 Model 2 Storage Control Unit or integrated attachements on small systems. Cefect skipping was essentially a factory only feature until 1981 when CCWs for management along with associated utilities were released.
First introduced with the 3380 DASD on the 3880 Director in 1981 the feature was included with the later CKD DASD subsystems. The dynamic path selection function controls operation of the two controllers, including simultaneous data transfer over the two paths. When supported by the operating system, each controller can serve as an alternate path in the event the other controller is unavailable.
Three additional commands, Set Path Group ID, Sense Path Group ID, and Suspend Multipath Reconnection, are used to support attachment of the 3380 Models havaing two controllers at the head of a string.
The Set Path Group ID command, with the dynamic path selection (DPS) function, provides greater flexibility in operations on reserved devices. Once a path group for a device has been established, it may be accessed over any path which is a member of the group to which it is reserved. In addition, on 370-XA systems which set the multipath mode bit in the function control byte (byte 0) to a 1, block multiplex reconnections will occur on the first available path which is a member of the group over which the channel program was initiated (regardless of the reservation state of the device).
If the controller designated in the I/O address is busy or disabled, the dynamic path selection allows an alternate path to the device to be established via another storage director and the other controller in the model AA.
Prior to Extended CKD (ECKD), CKD records were synchronously accessed, all activities required to end one CCW and initiate the next occurred in the gaps between the CKD fields. This placed limitations on gap size and cable length (speed of light issues) but did provide for very high performance since complex chains of CCWs could be performed by the subsystem without use of CPU memory or cycles.
With the 1981 introduction of nonsynchronous operation on the 3880 Director the gap timing constraint was removed. Five additional CCWs, Locate Record, Define Extent, Write Update Data, Write Update Key and Data, and Write CKD Next Track are used.
In nonsynchronous operation, the transfer of data between the channel and the storage control is not synchronized with the transfer of data between the storage control and the device. Channel programs can be executed such that channel and storage control activities required to end execution of one command and advance to the next do not have to occur during the inter-record gap between two adjacent fields. An intermediate buffer in the storage control allows independent operations between the channel and the device. A major advantage of ECKS is far longer cables; depending upon application it may improve performance.
ECKD CCWs are support on all subsequent CKD subsystems.
Caching first introduced in DASD CKD subsystems by Memorex (1978) and StorageTek[j] (1981) was subsequently introduced in late 1981 by IBM on the 3880 Model 13 for models of the 3380 with dynamic pathing.[k]
The cache is dynamically managed by an algorithm; high activity data is accessed from the high-performance cache and low activity data is accessed from less-expensive DASD storage. A large memory in the Director, the cache, is divided into track slots that store data from the 3380 tracks. A smaller area is a directory that contains entries that allow data to be located in the cache.
Caches were also provided on subsequently introduced storage controls.
Over time a number of path control, diagnostic and/or error recovery CCWs were implemented on one or more storage controls. For example:
- Unconditional Reserve allowed the releasing a device reserved to another channel and reserving the device to the channel issuing the command.
- Read Multiple Count Key Data could more efficiently read full tracks allowing for more efficient backups.
Reduced CPU and memory prices and higher device and interface speeds have somewhat nullified the advantages of CKD, and support continues by IBM to this date because it's flagship operating system z/OS continues to use CKD CCWs for many functions.
Originally CKD records had a one-to-one correspondence to a physical track of a DASD device; however over time the records have become more and more virtualized such that in a modern IBM mainframe there is no longer a direct correspondence between the a CKD record ID and a physical layout of a track. An IBM mainframe constructs CKD track images in memory and executes the ECKD and CKD channel programs against the image. To bridge between the native fixed block sized disks and the variable length ECKD/CKD record format, the CKD track images in memory are mapped onto a series of fixed blocks suitable for transfer to and from an FBA disk subsystem.
Of the 83 CKD CCWs implemented for System/360 and System/370 channels 56 are emulated on System/390 and later systems.
- Block (data storage)
- Data set (IBM mainframe)
- Fixed-block architecture (FBA)
- Record (computer science)
- Track (disk drive)
- Volume table of contents (VTOC)
- Most commonly a hard disk drive.
- data length 0 indicates EOF
- Because records are variable length and because the record number on the track need not be unique, the record number does not correspond to an angular displacement.
- A record with a zero data length is an EOF record and reading it causes a Unit Exception.
- In some early DASD the label was on a plug which allowed the address to be moved between DASD
- A unique combination of number of tracks and maximum track length. With this definition a double density DASD counts as a unique DASD.
- double density 2314, triple density 3330, double density 3350 and solid state disk
- Initially in a bundle of nine drives the drive model numbers became 2312 (1 drive), 2313 (4 drives), 2318 (2 drives) and 2319 (3 drives)
- Number of skippable defects varies by DASD model
- STK 8890 CyberCache for STK 3350 compatibles
- Simultaneously announced was the 3880-11 using its cache in a paging mode 3350s as paging devices
- IBM 3990 Storage Control Introduction – 6th Ed., IBM Corp, GA32-0098-05 February 1994
- "Count key data". IBM Knowledge Center. International Business Machines Corporation. Retrieved 6 August 2014.
- IBM System/360 Component Descriptions - 2841 and Associated DASD (PDF). Eighth Edition. IBM. December 1969. A26-5988-7.
- "Count-Key-Data Record Format". IBM 3390 Direct Access Storage Introduction (GC26-4573-03). International Business Machines Corporation. 22 October 1965.
- Houtekamer, Gilbert E.; Artis, H. Pat (1993). MVS I/O Subsystems: Configuration Management and Performance Analysis. New York: McGraw-Hill. ISBN 0-07-002553-3. OCLC 26096983.
- "Synchronous DASD Operations". Introduction to Nonsynchronous Direct Access Storage Subsystems (GC46-4519-0). International Business Machines Corporation. January 1990.
- IBM System/360 Principles of Operation, GA22-6821, Input/Output Operations
- IBM System/370 Principles of Operation, GA22-7000, Input/Output Operations
- IBM Enterprise Systems Architecture/370 Principles of Operation, SA22-7000, Chapter 13. I/O Overview
- Historical Narrative of the 1970s, US v IBM, Exhibit 14971, p.1051
- 3390 withdrawn from marketing in 1996
- 2820 SCU controlling the 2301 Drum
- IBM Corporation (1969). IBM System/360 Component Descriptions: 2314 Direct Access Storage Facility and 2844 Auxiliary Storage Control (PDF). IBM Corporation. p. 50.2.
- Derived from IBM System/360 Reference Data (Green) Card
- Introduction to Nonsynchronous Direct Access Storage Subsystems, IBM. GC26-4519-0, January 1990
- I/O Subsystem Architecture, J. Buzen, Proc IEEE, June 1975, p. 871
- Reference Manual for IBM 2835 Storage Control and IBM 2305 Fixed Head Storage Module, GA26-1589-2, August 1971
- Reference Manual for 3830 Model 1
- Device Support Facilities, User's Guide and Reference. Release 4.0, May 1981, pg vi, 46, 61, 87
- IBM 3880 Storage Control ,Models 1, 2, 3, and 4 Description Manual, GA26-1661-9,September 1987, Section 4
- IBM 3380 Direct Access Storage Description and User's Guide, GA26-1664-1, December 1981
- "Now Memorex fills the gap in your system's performance." Datamation Advertisement, August 1978, p. 85-6
- Introduction to IBM 3880 Storage Control Model 13, GA32-00622-0, September 1981
- IBM S/390 Multiprise 3000 Enterprise Server, Internal Disk Subsystem: Reference Guide. IBM. November 1999.
- IBM Data Processing Division (1974). Introduction to IBM Direct-Access Storage Devices and Organization Methods (PDF) (GC20-1649) (revised ed.). White Plains: International Business Machines. OCLC 8063006. Retrieved 6 August 2014.
- Development of 360/370 Architecture - A Plain Man's View P.J. Gribbin, February 10, 1989, Chapters 8-10.