Reading Count, Key and Data

Read Count

Now we will take a quick look at some of the other read commands.  First is the Read Count (X’12’) which reads the 8-byte count area (CCHHRKDL).  CCHHR is the 5-byte cylinder, head, record address of the record, K is the one-btye key length, and DL is the 2-byte record data length.  If we repace the X’06’ Read Data with X’12’ Read Count we get the following results.

I/O REQUEST                                                          
   COMPLETION CODE = 7F                                              
   CSW = 095B10 DEV STAT = 0C CHAN STAT = 00 RESIDUAL = 7FF8 (32,760)
   --- DEVICE STATUS  = CE DE                                        
   --- CHANNEL STATUS =                                              
   SENSE = 0000                                                      
   SEEK = 00000000D5000001                                           
   BYTES READ = 0008 (     8)                                        

----- READ COUNT -----                                               
0000 00D50000 02080100

We have dumped the contents of the contents of I/O buffer containing the count area just read.  CCHHR = 00D5000002 KL = 08 DL = 0100.  The first thing to note is our Seek Address was for record one but we read the count area for record two.  This is because the count area for record one has already passed the r/w heads (during the Search Command) so the next count area available to be read is for record 2.  We also see that the data block is 256 bytes long with an 8-byte key (you may recognize this as the format for a PDS directory block).

Read Key and Data

Next we will issue a Read Key and Data (X’0E’).  Here are the results.

I/O REQUEST                                                          
   COMPLETION CODE = 7F                                              
   CSW = 095B10 DEV STAT = 0C CHAN STAT = 00 RESIDUAL = 7EF8 (32,504)
   --- DEVICE STATUS  = CE DE                                        
   --- CHANNEL STATUS =                                              
   SENSE = 0000                                                      
   SEEK = 00000000D5000001                                           
   BYTES READ = 0108 (   264)                                        

----- READ KEY AND DATA -----                                        
0000 C1C8D3E6 E6D9C9E3 00FEC1C3 C3D6E4D5  E34000FA 1B2C00FA 21000000 0000C2E2
0020 00105810 58000000 88000001 0000C1C8  D3C3E6D9 C9E300A2 042C00A2 0A000000
0040 000002E2 0020A820 A8000000 88000001  0100C1C8 D3C7E3C6 4040009F 042C00A0
0060 01000000 000002E2 005AC043 38000000  88000001 0100C1C8 D3C9E6D9 C9E300A1
0080 172C00A2 01000000 000002E2 001A681A  68000000 88000001 0100C1C8 D3E3D4D6
00A0 D54000A1 0E2C00A1 14000000 000002E2  000A380A 38000000 88000001 0100C1C8
00C0 D3E6E3C1 E2D200A1 052C00A1 0B000000  000002E2 000C400C 40000000 88000001
00E0 0100C1C8 D3E6E6D9 C9E300A2 0D2C00A3  05000000 000002E2 00222022 20000000
0100 88000001 01000000

Here we read 264 bytes ( 8 bytes of Key + 256 bytes of Data).  It is our responsibility to know how many bytes are for the key and how many for the data.

Read Count, Key and Data

Now for the Read Count, Key and Data (X’1E’).  Here are the results.

I/O REQUEST
   COMPLETION CODE = 7F
   CSW = 095B10 DEV STAT = 0C CHAN STAT = 00 RESIDUAL = 7EF0 (32,496)
   --- DEVICE STATUS  = CE DE
   --- CHANNEL STATUS =
   SENSE = 0000
   SEEK = 00000000D5000001
   BYTES READ = 0110 (   272)
----- READ COUNT KEY AND DATA -----
0000 00D50000 02080100 C1D4C4D7 D9C3E5E3  00EEC1D4 C1D7E3C6 D3C50009 082E0009
0020 0D000000 000002E2 00212018 00000000  98000000 31970585 0100C1D4 C1D7E3C6
0040 F0F10009 122E000A 01000000 000002E2  000E680E 68000000 98000000 31970593
0060 0100C1D4 C1D7E3C6 F0F2000A 042E000A  09000000 000002E2 00020002 00000000
0080 98000000 31991261 0100C1D4 C1E2D7E9  C1D7000E 082E000F 01000000 000002E2
00A0 00357814 90000000 98000000 01960105  0101C1D4 C2D3C9E2 E34000CD 032C00CE
00C0 01000000 0000C2E2 00952043 B0000000  88000001 0000C1D4 C4D7D9C3 E5E30010
00E0 152E0010 1B000000 000002E2 0012000D  20000000 98000000 82150403 01000000
0100 00000000 00000000 00000000 00000000

Thsi time we read 272 bytes (8 bytes of count, 8 bytes of  key, and 256 bytes of data).  Also note that just like Read Count, the Read Count Key and Data command returned the next record following the record located with our Search Command.

Read Multiple Count Key and Data

This is a favorite or mine.  The Read Multiple Count Key and Data command can be used to read an entire track without knowing in advance the size or number of records on the track.  Because this is a Read Count type of command we need to Search to Record Zero.

I/O REQUEST                                                          
   COMPLETION CODE = 7F                                              
   CSW = 095B10 DEV STAT = 0C CHAN STAT = 00 RESIDUAL = 3FE0 (16,352)
   --- DEVICE STATUS  = CE DE                                        
   --- CHANNEL STATUS =                                              
   SENSE = 0000                                                      
   SEEK = 00000001AE000000                                           
   BYTES READ = 4020 (16,416)                                        

----- READ MULTIPLE COUNT KEY AND DATA -----
0000 01AE0000 01001000 C1C2C3C4 C5C6C7C8  00000000 00000000 00000000 00000000
0020 00000000 00000000 00000000 00000000  00000000 00000000 00000000 00000000
              LINES 00096040-00096FE0 SAME AS ABOVE                          
1000 00000000 00000000 01AE0000 02001000  40C2C3C4 C5C6C7C8 00000000 00000000
1020 00000000 00000000 00000000 00000000  00000000 00000000 00000000 00000000
              LINES 00097040-00097FE0 SAME AS ABOVE                          
2000 00000000 00000000 00000000 00000000  01AE0000 03001000 4040C3C4 C5C6C7C8
2020 00000000 00000000 00000000 00000000  00000000 00000000 00000000 00000000
              LINES 00098040-00098FE0 SAME AS ABOVE                          
3000 00000000 00000000 00000000 00000000  00000000 00000000 01AE0000 04001000
3020 404040C4 C5C6C7C8 00000000 00000000  00000000 00000000 00000000 00000000
3040 00000000 00000000 00000000 00000000  00000000 00000000 00000000 00000000
              LINES 00099060-00099FE0 SAME AS ABOVE                          
4000 00000000 00000000 00000000 00000000  00000000 00000000 00000000 00000000

Here I am reading a track containing four 4K blocks.  We see the buffer begins with the count area for record 1.  The key (if any) begins immediately following the count.  The data begins immediately following the key.  We determine the start of the next record by adding the Count length (8) to the Key length and the Data length.  Record 1 begins at offset 0.  It has no key and the data is 4096 (X’1000′) bytes.  Record 2 should then start at offset X’1008′.

This is a great way to read an entire track when the blocks are not all the same size and we don’t know how many blocks are on the track.

Leave a Reply

Your email address will not be published. Required fields are marked *