Now we can begin to explore DASD (disc) devices.  We will focus on “Count, Key, Data” (CKD) type devices, specifically the 3350.

******************WARNING********************

Doing I/O to a DASD device could result in data loss and possibly the need to reformat the volume.  Caution should be used and you should avoid using a volume with valuable data.

For testing I created a new 3350 device using the DASDINIT command from Hercules.  I added the device to my MVS 3.8J Hercules configuration and used the shared DASD feature to access it from my TXXOS Hercules.

I attached my 3350 device as device address x’345′ which happens to be sysgened as a 3350 on my MVS system.

******************WARNING********************

CKD devices have fixed Cylinder and Head arrangements but the record format on the track is up to the user or application.  Each track is identified by its Cylinder and Head address (CCHH).

Each track begins with a Home Address record.  This record is part of the track formatting and is not normally accessed by applications.  It is created when the dasd volume is formatted.  The Home Address is read and written using special CCW commands.

The Home Address is followed by Record Zero.  R0 normally does not contain any data and should be considered part of the track formatting.

Each record consists of three components: Count, Key and Data.  The count area describes the record.  The count area contains the record’s address (CCHHR), the Key area length, and the Data area length.  The key and data areas maybe zero.  A record with a Key Length of zero and a Data Length of zero indicates an End-Of-File (EOF) record.

The count area is followed by the Key (if present) and the Data (if present).

To access a record we first have to position the device to the proper location for the record.  This is accomplished using the SEEK and SEARCH commands.

SEEK (command code x’07’) is used to position the heads to the proper cylinder and to select the proper head.  A SEARCH command is used to position to the correct location on the track.  A SEARCH command is followed by a TIC command to “loop” the channel program until either the proper position is achieved or an error condition is signaled.

A typical channel command for  DASD begins with the SEEK, SEARCH, TIC sequence:

CCWSEEK  DC    X'07',AL3(MBBCCHHR+1),X'40',X'00',AL2(6)    SEEK    
         DC    X'31',AL3(MBBCCHHR+3),X'40',X'00',AL2(5)    SEARCH ID=    
         DC    X'08',AL3(*-8),X'40',X'00',AL2(0)           TIC
         DC    ...next CCW...                              Read/Write/etc.
*
*               +0+1+2+3+4+5+6+7         
*                 M B B C C H H R        
MBBCCHHR DC    X'0000000000000101'

The first CCW is the SEEK (x’07’), the data address is 6 bytes specifying 00CCHH.  We specify Command Chain to continue with the next CCW.

The second CCW is a SEARCH (x’31’ Search ID Equal), the data address is 5 bytes containing the record id (CCHHR) that will match the record ID in the count area.

The TIC will cause the channel program to loop back to the SEARCH if the record is not found.  If the record matching the CCHHR is found the program will skip over the TIC and execute the CCW following the TIC.

A search for a record may be performed either by record ID (CCHHR) or by key.  We can search for ID equal, ID high, or ID equal or high.  We can also search for key equal, key high, or key equal or high.  Each form of SEARCH has a unique command code.

To access the Key or Data area we search for the ID of the record we want to access.  To access the count area we have to search for the record before the record we want to access.  For example to read the Count area of record one we have to search for record zero.  If we just want to read the Data we would search for record one.

Cylinder zero, Track zero is reserved for IPL and Volume Label record.  Record zero is the first IPL record.  Like our first IPL card it contains a PSW and two CCW’s (a read followed by a TIC).  Record one is used to contain additional CCW’s.

Record three contains the volume label.  It contains the Volume Serial (VOLSER) and the address of the Volume Table Of Contents (VTOC).

Record four is used to contain additional IPL data that can be read by the CCW’s in record two.

[Next – DASD Volume Label Record and VTOC]