DISK1 Output

------- CC=00 HH=00 R=1 --------
----- CSW ------
00000D80  00000D78 0C0007E8 00000000 00000001  .......Y........

-----DATA BUFFER-----
00000E00  00060000 0000000F 03000000 00000001  ................
00000E10  00000000 00000000 00000000 00000000  ................

------- CC=00 HH=00 R=2 --------
----- CSW ------
00000D80  00000D78 0C000770 00000000 00000002  ................

-----DATA BUFFER-----
00000E00  07003AB8 40000006 31003ABE 40000005  ................
00000E10  08003AA0 00000000 06000000 20000000  ................
00000E20  00000000 00000000 00000400 00000000  ................
00000E30  00000000 00000000 00000000 00000000  ................
00000E40  00000000 00000000 00000000 00000000  ................
00000E50  00000000 00000000 00000000 00000000  ................
00000E60  00000000 00000000 00000000 00000000  ................
00000E70  00000000 00000000 00000000 00000000  ................
00000E80  00000000 00000000 00000000 00000000  ................

------- CC=00 HH=00 R=2 --------
----- CSW ------
00000D80  00000D78 0C0007B0 00000000 00000003  ................

-----DATA BUFFER-----
00000E00  E5D6D3F1 E3E7E7D6 E2F14000 00000101  VOL1TXXOS1......
00000E10  40404040 40404040 40404040 40404040  ................
00000E20  40404040 40404040 40C8C5D9 C3E4D3C5  .........HERCULE
00000E30  E2404040 40404040 40404040 40404040  S...............
00000E40  40404040 40404040 40404040 40404040  ................

------- VTOC FMT 4 DSCB --------
----- CSW ------
00000D80  00000D78 0C0007A0 00000000 00000101  ................

-----DATA BUFFER-----
00000E00  F4000000 01030D94 022B0000 00960001  4......M.....O..
00000E10  00000230 001E4B36 010B5209 02002F24  ................
00000E20  00000000 00000000 00000000 00000000  ................
00000E30  00000000 00000000 00000000 00010000  ................
00000E40  00000100 02000E00 00000000 00000000  ................
00000E50  00000000 00000000 00000000 00000000  ................

The first record CC=00 HH=00 R=1 is the first IPL record.  The residual length in the CSW is x’7E8′ so the record length as read is x’18’ (x’800′ – x’7E8′ = x’18’).  The second IPL record (R=2) is x’90’ in length.  The third record is the volume lable R=3 and is x’50’ (80 bytes) in length.  The first four bytes contain the label identifier ‘VOL1’, the next six bytes contain the volser followed by a space.  The next five bytes are the address of the VTOC.

I have highlighted several fields of interest in the Format 4 DSCB.

  • Offset x’00’ is one byte x’F4′ (C’4′) identifying this as a Format 4 DSCB
  • Offset x’12’ is a halfword containing the number of cylinders on the volume
  • Offset x’14’ is a halfword containing the number of tracks/cylinder (x’1E’)
  • Offset x’16’ is the track length
  • Offset x’1E’ is the number of DSCB’s per track
  • Offset x’1F’ is the number of directory blocks per track
  • Offset x’3D’ is the beginning of a 10-byte extent descriptor
  • Offset x’3F’ is 4 bytes with the beginning CCHH for the VTOC (0000 0001)
  • Offset x’43’ is 4 bytes with the ending CCHH of the VTOC (0002 000E)

[Next – DISK I/O Subroutine]

DISK1 Assembly Listing

  LOC  OBJECT CODE    ADDR1 ADDR2  STMT   SOURCE STATEMENT                                       ASM 0201 17.13 11/25/11

000000                                1 DISK1    START 0                                                        00010000
000000 0000000000000800               2 STARTPSW DC    X'0000000000',AL3(BEGIN)                                 00020000
                                      3 *                                                                       00030000
                                      4 *                                                                       00040000
000008                      00800     5          ORG   DISK1+2048                                               00050000
                                      6 *                                                                       00060000
000800 05C0                           7 BEGIN    BALR  R12,0         SET BASE REGISTER                          00070000
                            00802     8          USING *,R12                                                    00080000
                                      9 *                                                                       00090000
000802 41D0 C5A2      00DA4          10          LA    R13,SAVEA     FIRST SAVE AREA                            00100000
                                     11 *                                                                       00110000
                                     12 *                                                                       00120000
                                     13 *                                                                       00130000
000806 9201 C58D      00D8F          14          MVI   R,1                READ RECORD 1                         00140000
                                     15          @PRINT '------- CC=00 HH=00 R=1 --------'                      00150000
00080A 4110 C48E      00C90          16+         LA     R1,=C'------- CC=00 HH=00 R=1 --------'                 00170000
00080E 4100 0020      00020          17+         LA     R0,32                                                   00200000
000812 41F0 C132      00934          18+         LA     R15,@PRINT                                              00210000
000816 05EF                          19+         BALR   R14,R15                                                 00220000
000818 45E0 C068      0086A          20          BAL   R14,DUMPREC                                              00160000
                                     21 *                                                                       00170000
                                     22 *                                                                       00180000
                                     23 *                                                                       00190000
00081C 9202 C58D      00D8F          24          MVI   R,2                READ RECORD 2                         00200000
                                     25          @PRINT '------- CC=00 HH=00 R=2 --------'                      00210000
000820 4110 C4AE      00CB0          26+         LA     R1,=C'------- CC=00 HH=00 R=2 --------'                 00170000
000824 4100 0020      00020          27+         LA     R0,32                                                   00200000
000828 41F0 C132      00934          28+         LA     R15,@PRINT                                              00210000
00082C 05EF                          29+         BALR   R14,R15                                                 00220000
00082E 45E0 C068      0086A          30          BAL   R14,DUMPREC                                              00220000
                                     31 *                                                                       00230000
                                     32 *                                                                       00240000
                                     33 *                                                                       00250000
000832 9203 C58D      00D8F          34          MVI   R,3                READ RECORD 3                         00260000
                                     35          @PRINT '------- CC=00 HH=00 R=2 --------'                      00270000
000836 4110 C4AE      00CB0          36+         LA     R1,=C'------- CC=00 HH=00 R=2 --------'                 00170000
00083A 4100 0020      00020          37+         LA     R0,32                                                   00200000
00083E 41F0 C132      00934          38+         LA     R15,@PRINT                                              00210000
000842 05EF                          39+         BALR   R14,R15                                                 00220000
000844 45E0 C068      0086A          40          BAL   R14,DUMPREC                                              00280000
                                     41 *                                                                       00290000
                                     42 *                                                                       00300000
                                     43 *                                                                       00310000
000848 D204 C58E C609 00D90 00E0B    44          MVC   VTOCADDR,INBUF+11  SAVE VTOC ADDRESS FROM VOL RECORD     00320000                                                                                                               PAGE    3

  LOC  OBJECT CODE    ADDR1 ADDR2  STMT   SOURCE STATEMENT                                       ASM 0201 17.13 11/25/11

                                     45 *                                                                       00330000
                                     46 *                                                                       00340000
00084E D204 C589 C58E 00D8B 00D90    47          MVC   CCHHR(5),VTOCADDR  READ FIRST VTOC RECORD                00350000
                                     48          @PRINT '------- VTOC FMT 4 DSCB --------'                      00360000
000854 4110 C4CE      00CD0          49+         LA     R1,=C'------- VTOC FMT 4 DSCB --------'                 00170000
000858 4100 0020      00020          50+         LA     R0,32                                                   00200000
00085C 41F0 C132      00934          51+         LA     R15,@PRINT                                              00210000
000860 05EF                          52+         BALR   R14,R15                                                 00220000
000862 45E0 C068      0086A          53          BAL   R14,DUMPREC                                              00370000
                                     54 *                                                                       00380000
                                     55 *                                                                       00390000
                                     56 *                                                                       00400000
000866 47F0 C12E      00930          57          B     EXIT                                                     00410000
                                     58 *                                                                       00420000
                                     59 **********************************************************************  00430000
                                     60 *                                                                       00440000
                                     61 **********************************************************************  00450000
                                     62 *                                                                       00460000
00086A                               63 DUMPREC  DS    0H                                                       00470000
00086A 50E0 C59E      00DA0          64          ST    R14,DUMPRCXT       SAVE RETURN ADDRESS                   00480000
                                     65 *                                                                       00490000
00086E 4110 C556      00D58          66          LA    R1,CCWSEEK         POINT TO CCW  CHAIN                   00500000
000872 5010 0048      00048          67          ST    R1,72              SAVE INTO CAW                         00510000
000876 4120 0345      00345          68          LA    R2,X'345'          DISK DEVICE ADDRESS                   00520000
00087A 9C00 2000      00000          69          SIO   0(R2)              START I/O                             00530000
00087E 4770 C10A      0090C          70          BNZ   ERR1               BRANCH IF SIO NOT ACCEPTED            00540000
                                     71 *                                                                       00550000
000882 9D00 2000      00000          72 WAIT     TIO   0(R2)              WAIT FOR I/O COMPLETION               00560000
000886 4780 C090      00892          73          BZ    DUMP               GO DUMP RECORD                        00570000
00088A 4710 C11C      0091E          74          BC    1,ERR2             BRANCH IF ERROR                       00580000
00088E 47F0 C080      00882          75          B     WAIT               KEEP WAITING...                       00590000
                                     76 *                                                                       00600000
                                     77 *                                                                       00610000
000892                               78 DUMP     DS     0H                                                      00620000
000892 D207 C57E 0040 00D80 00040    79          MVC    CSW,64                 SAVE CSW FOR LATER               00630000
                                     80 *                                                                       00640000
                                     81          @PRINT '----- CSW ------'                                      00650000
000898 4110 C4EE      00CF0          82+         LA     R1,=C'----- CSW ------'                                 00170000
00089C 4100 0010      00010          83+         LA     R0,16                                                   00200000
0008A0 41F0 C132      00934          84+         LA     R15,@PRINT                                              00210000
0008A4 05EF                          85+         BALR   R14,R15                                                 00220000
                                     86          @DUMP  CSW,10                                                  00660000
0008A6 4110 C57E      00D80          87+         LA    R1,CSW                                                   00360000
0008AA 4100 000A      0000A          88+         LA    R0,10                                                    00360000                                                                                                               PAGE    4

  LOC  OBJECT CODE    ADDR1 ADDR2  STMT   SOURCE STATEMENT                                       ASM 0201 17.13 11/25/11

0008AE 41F0 C1F8      009FA          89+         LA    R15,@DUMP                                                00080000
0008B2 05EF                          90+         BALR  R14,R15                                                  00090000
                                     91          @PRINT ' '                                                     00670000
0008B4 4110 C4FE      00D00          92+         LA     R1,=C' '                                                00170000
0008B8 4100 0001      00001          93+         LA     R0,1                                                    00200000
0008BC 41F0 C132      00934          94+         LA     R15,@PRINT                                              00210000
0008C0 05EF                          95+         BALR   R14,R15                                                 00220000
                                     96          @PRINT '-----DATA BUFFER-----'                                 00680000
0008C2 4110 C4FF      00D01          97+         LA     R1,=C'-----DATA BUFFER-----'                            00170000
0008C6 4100 0015      00015          98+         LA     R0,21                                                   00200000
0008CA 41F0 C132      00934          99+         LA     R15,@PRINT                                              00210000
0008CE 05EF                         100+         BALR   R14,R15                                                 00220000
                                    101 *                                                                       00690000
0008D0 1F33                         102          SLR    R3,R3                  ZERO R3                          00700000
0008D2 BF33 C574      00D76         103          ICM    R3,B'0011',CCWREAD+6   GET CCW DATA LENGTH              00710000
0008D6 1F11                         104          SLR    R1,R1                  ZERO R1                          00720000
0008D8 BF13 C584      00D86         105          ICM    R1,B'0011',CSW+6       GET RESIDUAL LENGTH              00730000
0008DC 1B31                         106          SR     R3,R1                  CALCULATE LENGTH READ            00740000
                                    107 *                                                                       00750000
                                    108          @DUMP  INBUF,(R3)                                              00760000
0008DE 4110 C5FE      00E00         109+         LA    R1,INBUF                                                 00360000
0008E2 1803                         110+         LR    R0,R3                                                    00290000
0008E4 41F0 C1F8      009FA         111+         LA    R15,@DUMP                                                00080000
0008E8 05EF                         112+         BALR  R14,R15                                                  00090000
                                    113 *                                                                       00770000
                                    114          @PRINT ' '                                                     00780000
0008EA 4110 C4FE      00D00         115+         LA     R1,=C' '                                                00170000
0008EE 4100 0001      00001         116+         LA     R0,1                                                    00200000
0008F2 41F0 C132      00934         117+         LA     R15,@PRINT                                              00210000
0008F6 05EF                         118+         BALR   R14,R15                                                 00220000
                                    119          @PRINT ' '                                                     00790000
0008F8 4110 C4FE      00D00         120+         LA     R1,=C' '                                                00170000
0008FC 4100 0001      00001         121+         LA     R0,1                                                    00200000
000900 41F0 C132      00934         122+         LA     R15,@PRINT                                              00210000
000904 05EF                         123+         BALR   R14,R15                                                 00220000
                                    124 *                                                                       00800000
000906 58E0 C59E      00DA0         125          L     R14,DUMPRCXT       SAVE RETURN ADDRESS                   00810000
00090A 07FE                         126          BR     R14               RETURN TO CALLER                      00820000
                                    127 *                                                                       00830000
                                    128 *                                                                       00840000
                                    129 ERR1     @PRINT '*** I/O ERROR (SIO) ON DEVICE 345'                     00850000
00090C 4110 C514      00D16         130+ERR1     LA     R1,=C'*** I/O ERROR (SIO) ON DEVICE 345'                00170000
000910 4100 0021      00021         131+         LA     R0,33                                                   00200000
000914 41F0 C132      00934         132+         LA     R15,@PRINT                                              00210000
                                                                                                               PAGE    5

  LOC  OBJECT CODE    ADDR1 ADDR2  STMT   SOURCE STATEMENT                                       ASM 0201 17.13 11/25/11

000918 05EF                         133+         BALR   R14,R15                                                 00220000
00091A 47F0 C12E      00930         134          B     EXIT                                                     00860000
                                    135 *                                                                       00870000
                                    136 *                                                                       00880000
                                    137 ERR2     @PRINT '*** I/O ERROR (TIO) ON DEVICE 345'                     00890000
00091E 4110 C535      00D37         138+ERR2     LA     R1,=C'*** I/O ERROR (TIO) ON DEVICE 345'                00170000
000922 4100 0021      00021         139+         LA     R0,33                                                   00200000
000926 41F0 C132      00934         140+         LA     R15,@PRINT                                              00210000
00092A 05EF                         141+         BALR   R14,R15                                                 00220000
00092C 47F0 C12E      00930         142          B     EXIT                                                     00900000
                                    143 *                                                                       00910000
                                    144 **********************************************************************  00920000
                                    145 *                                                                       00930000
000930 8200 C596      00D98         146 EXIT     LPSW   DONE             LOAD A WAIT PSW                        00940000
                                    147 *                                                                       00950000
                                    148 **********************************************************************  00960000
                                    149 *                                                                       00970000
                                    150          PRINT  NOGEN                                                   00980000
                                    151          @PRINT GEN=YES                                                 00990000
                                    182          @CARD  GEN=YES                                                 01000000
                                    216          @DUMP  GEN=YES                                                 01010000
                                    302          @ERR  ,                                                        01020000
                                    306          @REGS ,                                                        01030000
                                    323          PRINT GEN                                                      01040000
                                    324 *                                                                       01050000
                                    325 **********************************************************************  01060000
                                    326 *                                                                       01070000
000C90                              327          LTORG ,                                                        01080000
000C90 6060606060606040             328                =C'------- CC=00 HH=00 R=1 --------'
000CB0 6060606060606040             329                =C'------- CC=00 HH=00 R=2 --------'
000CD0 6060606060606040             330                =C'------- VTOC FMT 4 DSCB --------'
000CF0 606060606040C3E2             331                =C'----- CSW ------'
000D00 40                           332                =C' '
000D01 6060606060C4C1E3             333                =C'-----DATA BUFFER-----'
000D16 5C5C5C40C961D640             334                =C'*** I/O ERROR (SIO) ON DEVICE 345'
000D37 5C5C5C40C961D640             335                =C'*** I/O ERROR (TIO) ON DEVICE 345'
                                    336 *                                                                       01090000
                                    337 **********************************************************************  01100000
                                    338 *                                                                       01110000
000D58                              339          DS    0D                                                       01120000
000D58 07000D8940000006             340 CCWSEEK  DC    X'07',AL3(MBBCCHHR+1),AL1(@CCW#CC),X'00',AL2(6)          01130000
000D60 31000D8B40000005             341 CCWSRCH  DC    X'31',AL3(MBBCCHHR+3),AL1(@CCW#CC),X'00',AL2(5)          01140000
000D68 08000D6040000000             342          DC    X'08',AL3(CCWSRCH),AL1(@CCW#CC),X'00',AL2(0)             01150000
000D70 06000E0020000800             343 CCWREAD  DC    X'06',AL3(INBUF),AL1(@CCW#SLI),X'00',AL2(2048)           01160000                                                                                                               PAGE    6

  LOC  OBJECT CODE    ADDR1 ADDR2  STMT   SOURCE STATEMENT                                       ASM 0201 17.13 11/25/11

                                    344 *                                                                       01170000
                                    345 *                                                                       01180000
000D78                              346          DS    XL((((*-BEGIN+16)/16)*16)-(*-BEGIN))                     01190000
000D80 0000000000000000             347 CSW      DC    D'0'                                                     01200000
                                    348 *                                                                       01210000
                                    349 *               +0+1+2+3+4+5+6+7                                        01220000
                                    350 *                 M B B C C H H R                                       01230000
                                    351 **********     X'0000000000000001'                                      01240000
                                    352 *                                                                       01250000
000D88                              353 MBBCCHHR DS    0X                                                       01260000
000D88 000000                       354 MBB      DC    X'000000'                                                01270000
000D8B                              355 CCHHR    DS    0X                                                       01280000
000D8B 0000                         356 CC       DC    X'0000'                                                  01290000
000D8D 0000                         357 HH       DC    X'0000'                                                  01300000
000D8F 01                           358 R        DC    X'01'                                                    01310000
                                    359 *                                                                       01320000
                                    360 *                                                                       01330000
000D90 0000000000                   361 VTOCADDR DC   XL5'00'        ADDR OF VTOC FROM VOLUME LABEL RECORD      01340000
                                    362 *                                                                       01350000
                                    363 *                                                                       01360000
                                    364 **********************************************************************  01370000
                                    365 *                                                                       01380000
000D98                              366          DS    0D                                                       01390000
000D98 000200000099FACE             367 DONE     DC    X'0002000000',X'99FACE'                                  01400000
                                    368 *                                                                       01410000
000DA0 00000000                     369 DUMPRCXT DC    F'0'                                                     01420000
                                    370 *                                                                       01430000
000DA4                              371 SAVEA    DS    18F                                                      01440000
                                    372 *                                                                       01450000
000DF0                              373          DS    0D                                                       01460000
000DF0                              374          DS    XL((((*-BEGIN+256)/256)*256)-(*-BEGIN))                  01470000
000E00                              375 INBUF    DS    XL2048                                                   01480000
                                    376 *                                                                       01490000
                                    377          @CCW  ,                                                        01500000
                            00080   378+@CCW#CD  EQU   X'80'         * CHAIN DATA                               00030000
                            00040   379+@CCW#CC  EQU   X'40'         * COMMAND CHAIN                            00040000
                            00020   380+@CCW#SLI EQU   X'20'         * SUPPRESS LENGTH INDICATION               00050000
                            00010   381+@CCW#SKP EQU   X'10'         * SKIP                                     00060000
                            00008   382+@CCW#PCI EQU   X'08'         * PROGRAM CONTROLLED INTERRUPT             00070000
                            00004   383+@CCW#IDA EQU   X'04'         * INDIRECT ADDRESS                         00080000
                                    384+*                                                                       00090000
                                    385+*                                                                       00100000
000000                              386+@CCW     DSECT ,                                                        00110000
000000                              387+@CCWCMD  DS    X             - COMMAND CODE                             00120000                                                                                                               PAGE    7

  LOC  OBJECT CODE    ADDR1 ADDR2  STMT   SOURCE STATEMENT                                       ASM 0201 17.13 11/25/11

000001                              388+@CCWDATA DS    AL3           - DATA ADDRESS                             00130000
000004                              389+@CCWFLAG DS    X             - FLAGS                                    00140000
000005                              390+         DS    X             - RESERVED (ZERO)                          00150000
000006                              391+@CCWLEN  DS    AL2 N         - LENGTH                                   00160000
                                    392+*                                                                       00170000
                                    393 *                                                                       01510000
                                    394          END   ,                                                        01520000

[Next – DISK1 Output]

DISK1 Program

The DISK1 program will read and dump records from our DASD volume.  Most of the work will be done in a subroutine called DUMPREC.  It will read a block given a CCHHR address and dump the contents to the printer.

 DUMPREC  DS    0H                                                  
          ST    R14,DUMPRCXT       SAVE RETURN ADDRESS              
 *                                                                  
          LA    R1,CCWSEEK         POINT TO CCW  CHAIN              
          ST    R1,72              SAVE INTO CAW                    
          LA    R2,X'345'          DISK DEVICE ADDRESS              
          SIO   0(R2)              START I/O                        
          BNZ   ERR1               BRANCH IF SIO NOT ACCEPTED       
 *                                                                  
 WAIT     TIO   0(R2)              WAIT FOR I/O COMPLETION          
          BZ    DUMP               GO DUMP RECORD                   
          BC    1,ERR2             BRANCH IF ERROR                  
          B     WAIT               KEEP WAITING...

By now this code should look pretty familiar.  We save the caller’s return address.  Next we store the address of our CCW program into the CAW and then issue the SIO.  We use TIO to wait for the I/O to complete.

DUMP     DS     0H                                                    
         MVC    CSW,64                 SAVE CSW FOR LATER             
*                                                                     
         @PRINT '----- CSW ------'                                    
         @DUMP  CSW,10                                                
         @PRINT ' '                                                   
         @PRINT '-----DATA BUFFER-----'                               
*                                                                     
         SLR    R3,R3                  ZERO R3                        
         ICM    R3,B'0011',CCWREAD+6   GET CCW DATA LENGTH            
         SLR    R1,R1                  ZERO R1                        
         ICM    R1,B'0011',CSW+6       GET RESIDUAL LENGTH            
         SR     R3,R1                  CALCULATE LENGTH READ          
*                                                                     
         @DUMP  INBUF,(R3)                                            
*                                                                     
         @PRINT ' '                                                   
         @PRINT ' '                                                   
*                                                                     
         L     R14,DUMPRCXT       SAVE RETURN ADDRESS                 
         BR     R14               RETURN TO CALLER

After the DASD I/O is complete we save the CSW because it will be overwritten when we issue I/O to the printer.  We use our @DUMP macro to format the storage containing our saved CSW.

Next we get the residual length value from the CSW and subtract it from the length value in our read CCW.  This gives us the actual length of the data that was read.  (For example if we attempted to read 100 bytes of data and the residual length was 40 – we would have actually read 60 bytes of data).

We then format the contents of the I/O data buffer and then return to the caller.

         DS    0D                                                    
CCWSEEK  DC    X'07',AL3(MBBCCHHR+1),AL1(@CCW#CC),X'00',AL2(6)       
CCWSRCH  DC    X'31',AL3(MBBCCHHR+3),AL1(@CCW#CC),X'00',AL2(5)       
         DC    X'08',AL3(CCWSRCH),AL1(@CCW#CC),X'00',AL2(0)          
CCWREAD  DC    X'06',AL3(INBUF),AL1(@CCW#SLI),X'00',AL2(2048)        
*                                                                    
*

Our CCW program begins with a Seek (x’07’).  It is followed by a Search ID Equal (x’31’) and a TIC (x’08) to search for the specific record we want to read.  Finally we use a Read Data (x’06’) to read the data area of the record.

We specify Command Chaining on all CCW’s except the last.  Our Read CCW has the SLI since we don’t expect our requested length to match the actual data length.

                                                                    
         DS    XL((((*-BEGIN+16)/16)*16)-(*-BEGIN))                  
CSW      DC    D'0'                                                  
*                                                                    
*               +0+1+2+3+4+5+6+7                                     
*                 M B B C C H H R                                    
**********     X'0000000000000001'                                   
*                                                                    
MBBCCHHR DS    0X                                                    
MBB      DC    X'000000'                                             
CCHHR    DS    0X                                                    
CC       DC    X'0000'                                               
HH       DC    X'0000'                                               
R        DC    X'01'                                                 
*

The strange looking DS XL statement is used to align the address to a multiple of 16 bytes.  We use a similar DS  to align the I/O buffer to an even multiple of 256 (so when we format the buffer the beginning address is XXXXX00).

          MVI   R,1                READ RECORD 1                 
          @PRINT '------- CC=00 HH=00 R=1 --------'              
          BAL   R14,DUMPREC                                      
 *                                                               
          MVI   R,2                READ RECORD 2                 
          @PRINT '------- CC=00 HH=00 R=2 --------'              
          BAL   R14,DUMPREC

First we dump record R1 and R2 (IPL1 and IPL2)  Since the CCHH is already set to cylinder 0 and Head 0 all we have to do is specify the record number.

         MVI   R,3                READ RECORD 3                       
         @PRINT '------- CC=00 HH=00 R=2 --------'                    
         BAL   R14,DUMPREC                                            
*                                                                     
         MVC   VTOCADDR,INBUF+11  SAVE VTOC ADDRESS FROM VOL RECORD   
*                                                                     
         MVC   CCHHR(5),VTOCADDR  READ FIRST VTOC RECORD              
         @PRINT '------- VTOC FMT 4 DSCB --------'                    
         BAL   R14,DUMPREC

Next we read record 3 which is the volume label.  The CCHHR address of the VTOC is saved and then moved into our DASD block address MBBCCHHR area.  We can then read and dump the Format 4 DSCB data area.

[Next – DISK1 Assembly Listing]

DASD Volume Label Record and VTOC

Now we can write a program to read and dump some records from our DASD volume.  Because I formatted the volume there should be three data records on Cylinder zero, Track zero (R1,R2, and R3).  Record 3 is the Volume Label record and will have the address of the Volume Table Of Contents (VTOC).

The Volume Record has a 4-byte key and an 80-byte data area.  We are only concerned with the following data fields:

Key:
     CL4    'VOL1'

Data:
     CL4    'VOL1'
     CL6    volser
     CL1
     XL5    vtoc address (cchhr)

The VTOC is a special file that describes the data sets and free space on the volume.  The records in the VTOC are called Data Set Control Block (DSCB) records.  Each record consists of a 44-byte key and a 96-byte data area. There are six different types of DSCB records (Format 1 through Format 6).

  • Format 1 DSCB – Describes a data set
  • Format 2 DSCB – Describes characteristics of an ISAM data set
  • Format 3 DSCB – Describes additional extents of a data set
  • Format 4 DSCB – Describes the VTOC data set
  • Format 5 DSCB – Describes free space
  • Format 6 DSCB – Shared cylinder allocation

The first DSCB is always a Format 4.  The 44-byte key contains a special string of characters x’040404….04′ which identifies it as the FMT4 DSCB. Data of interest to us include:

  • DS4HPCHR – Highest Address of a Format 1 DSCB
  • DS4DEVSZ – Cylinders/Device & Tracks/Cylinder
  • DS4DEVTK – Device Track Length
  • DS4DEVDT – Number of DSCB’s per Track
  • DS4DEVDB – Number of Directory Blocks per Track
  • DS4VTOCE – VTOC Exten Description

This information will allow us to read the VTOC and find other data sets located on this volume.

[Next – DISK1 Program]

 

 

 

Direct Access Storage Devices – DASD

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]

ABSTEST2 Printer Output

Below is the printer output produced when the ABSTEST2 IPL deck is run under Hercules.


HELLO, WORLD
--------------------------------------------------
THIS IS A TEST CARD IN THE INPUT READER                                 00300000
NOW WE HAVE THE SECOND CARD IN READER                                   00310000
THE THIRD CARD IN THE CARD READER                                       00320000
FOURTH CARD IN OUR CARD READER                                          00330000
--------------------------------------------------

00000800  05C041D0 C41E4110 C4B64100 000C41F0  ....D...D......0
00000810  C08005EF 4110C3DE 41000032 41F0C080  ......C......0..
00000820  05EF4110 C46641F0 C0DE05EF 12FF4770  ....D..0........
00000830  C0424110 C4664100 005041F0 C08005EF  ....D....&.0....
00000840  47F0C020 4110C3DE 41000032 41F0C080  .0....C......0..
00000850  05EF4110 C4C64100 000141F0 C08005EF  ....DF.....0....
00000860  4110C4C6 41000001 41F0C080 05EF5850  ..DF.....0.....&
00000870  C4C21815 41000080 41F0C148 05EF8200  DB.......0A...B.

[Next – Direct Access Storage Devices (DASD)]

ABSTEST2 JCL

Here is the JCL I used to generate the IPL card deck for the ABSTEST2 macro test program.

First we execute our ABSLOAD program to generate the cards for the Absolute Loader.  Next we run the assembler to assemble ABSTEST2 and punch out the object deck immediately following the Absolute Loader.  Finally we can use IEBGENER to copy some card images to follow the object deck so our program has something to read.

//TXXABST2 JOB 5222,'ALDR TST',CLASS=A,MSGCLASS=A,
//        MSGLEVEL=(1,1)
/*JOBPARM K=0
//TXXOSRUN EXEC PGM=ABSLOAD
//STEPLIB   DD  DISP=SHR,DSN=TXXOS.CARD.LOAD
//SYSUDUMP  DD  SYSOUT=A
//PUNCH     DD  UNIT=00D
//*
//*
//*
//*
//ASM      EXEC  PGM=IFOX00,REGION=1024K,
//         PARM='LINECOUNT(44)'
//SYSLIB   DD    DISP=SHR,DSN=SYS1.MACLIB
//         DD    DISP=SHR,DSN=SYS1.AMODGEN
//         DD    DISP=SHR,DSN=TXXOS.CARD.ASM
//SYSUT1   DD    DSN=&&SYSUT1,UNIT=VIO,SPACE=(1700,(600,100))
//SYSUT2   DD    DSN=&&SYSUT2,UNIT=VIO,SPACE=(1700,(300,50))
//SYSUT3   DD    DSN=&&SYSUT3,UNIT=VIO,SPACE=(1700,(300,50))
//SYSPRINT DD    SYSOUT=*
//SYSPUNCH DD    UNIT=00D
//SYSIN    DD    DISP=SHR,DSN=TXXOS.CARD.ASM(ABSTEST2)
//*
//*
//GENR   EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSIN    DD DUMMY
//SYSUT2   DD UNIT=00D,DCB=BLKSIZE=80
//SYSUT1   DD *
THIS IS A TEST CARD IN THE INPUT READER
NOW WE HAVE THE SECOND CARD IN READER
THE THIRD CARD IN THE CARD READER
FOURTH CARD IN OUR CARD READER
/* LAST DATA RECORD...

[Next – ABSTEST2 Printer Output]

ABSTEST2 Assembly Listing

                                               EXTERNAL SYMBOL DICTIONARY                                      PAGE    1

SYMBOL   TYPE  ID   ADDR  LENGTH LDID                                                            ASM 0201 14.36 11/21/11

ABSTEST2  SD  0001 000000 000CC9                                                                                                               PAGE    2

  LOC  OBJECT CODE    ADDR1 ADDR2  STMT   SOURCE STATEMENT                                       ASM 0201 14.36 11/21/11

000000                                1 ABSTEST2 START 0                                                        00010000
000000 0000000000000800               2 WAITPSW  DC    X'0000000000',AL3(BEGIN)                                 00020000
                                      3 *                                                                       00030000
                                      4 *                                                                       00040000
000008                      00800     5          ORG   ABSTEST2+2048                                            00050000
                                      6 *                                                                       00060000
000800 05C0                           7 BEGIN    BALR  R12,0         SET BASE REGISTER                          00070000
                            00802     8          USING *,R12                                                    00080000
                                      9 *                                                                       00090000
000802 41D0 C41E      00C20          10          LA    R13,SAVEA     FIRST SAVE AREA                            00100000
                                     11 *                                                                       00110000
                                     12          @PRINT 'HELLO, WORLD'   PRINT "HELLO WORLD"                    00120000
000806 4110 C4B6      00CB8          13+         LA     R1,=C'HELLO, WORLD'                                     00170000
00080A 4100 000C      0000C          14+         LA     R0,12                                                   00200000
00080E 41F0 C080      00882          15+         LA     R15,@PRINT                                              00210000
000812 05EF                          16+         BALR   R14,R15                                                 00220000
                                     17          @PRINT DASH,LEN=L'DASH  PRINT A LINE OF DASHES                 00130000
000814 4110 C3DE      00BE0          18+         LA    R1,DASH                                                  00360000
000818 4100 0032      00032          19+         LA    R0,L'DASH                                                00360000
00081C 41F0 C080      00882          20+         LA     R15,@PRINT                                              00110000
000820 05EF                          21+         BALR   R14,R15                                                 00120000
                                     22 *                                                                       00140000
000822                               23 LOOP     DS    0H                                                       00150000
                                     24          @CARD INBUF             READ A CARD                            00160000
000822 4110 C466      00C68          25+         LA    R1,INBUF                                                 00360000
000826 41F0 C0DE      008E0          26+         LA    R15,@CARD                                                00080000
00082A 05EF                          27+         BALR  R14,R15                                                  00090000
00082C 12FF                          28          LTR   R15,R15           CHECK FOR GOOD READ                    00170000
00082E 4770 C042      00844          29          BNZ   LOOPEND                                                  00180000
                                     30          @PRINT INBUF,LEN=L'INBUF    PRINT THE CARD                     00190000
000832 4110 C466      00C68          31+         LA    R1,INBUF                                                 00360000
000836 4100 0050      00050          32+         LA    R0,L'INBUF                                               00360000
00083A 41F0 C080      00882          33+         LA     R15,@PRINT                                              00110000
00083E 05EF                          34+         BALR   R14,R15                                                 00120000
000840 47F0 C020      00822          35          B     LOOP              LOOP BACK FOR ANOTHER CARD             00200000
                                     36 *                                                                       00210000
                                     37 *                                                                       00220000
000844                               38 LOOPEND  DS    0H                                                       00230000
                                     39          @PRINT DASH,LEN=L'DASH  PRINT A LINE OF DASHES                 00240000
000844 4110 C3DE      00BE0          40+         LA    R1,DASH                                                  00360000
000848 4100 0032      00032          41+         LA    R0,L'DASH                                                00360000
00084C 41F0 C080      00882          42+         LA     R15,@PRINT                                              00110000
000850 05EF                          43+         BALR   R14,R15                                                 00120000
                                     44          @PRINT ' '              PRINT BLANK                            00250000                                                                                                               PAGE    3

  LOC  OBJECT CODE    ADDR1 ADDR2  STMT   SOURCE STATEMENT                                       ASM 0201 14.36 11/21/11

000852 4110 C4C6      00CC8          45+         LA     R1,=C' '                                                00170000
000856 4100 0001      00001          46+         LA     R0,1                                                    00200000
00085A 41F0 C080      00882          47+         LA     R15,@PRINT                                              00210000
00085E 05EF                          48+         BALR   R14,R15                                                 00220000
                                     49          @PRINT ' '                         LINES                       00260000
000860 4110 C4C6      00CC8          50+         LA     R1,=C' '                                                00170000
000864 4100 0001      00001          51+         LA     R0,1                                                    00200000
000868 41F0 C080      00882          52+         LA     R15,@PRINT                                              00210000
00086C 05EF                          53+         BALR   R14,R15                                                 00220000
                                     54 *                                                                       00270000
                                     55 *                                                                       00280000
00086E 5850 C4C2      00CC4          56          L      R5,=A(BEGIN)                                            00290000
                                     57          @DUMP  (R5),128         DUMP SOME STORAGE                      00300000
000872 1815                          58+         LR    R1,R5                                                    00290000
000874 4100 0080      00080          59+         LA    R0,128                                                   00360000
000878 41F0 C148      0094A          60+         LA    R15,@DUMP                                                00080000
00087C 05EF                          61+         BALR  R14,R15                                                  00090000
                                     62 *                                                                       00310000
                                     63 *                                                                       00320000
00087E 8200 C416      00C18          64          LPSW   DONE             LOAD A WAIT PSW                        00330000
                                     65 *                                                                       00340000
                                     66 **********************************************************************  00350000
                                     67 *                                                                       00360000
                                     68          @PRINT GEN=YES                                                 00370000
000882 90EC D00C      0000C          69+@PRINT   STM    R14,R12,12(R13)        SAVE CALLERS REGISTERS           00270000
000886 1821                          70+         LR     R2,R1                  POINT TO DATA TO PRINT           00280000
000888 1830                          71+         LR     R3,R0                  LENGTH OF DATA TO PRINT          00290000
00088A 4110 0084      00084          72+         LA     R1,132                 MAX LENGTH WE CAN PRINT          00300000
00088E 1931                          73+         CR     R3,R1                  TOO BIG                          00310000
000890 47D0 C094      00896          74+         BNH    @001801                NO - BRANCH                      00320000
000894 1831                          75+         LR     R3,R1                  SET TO MAX                       00330000
000896                               76+@001801  DS     0H                                                      00340000
000896 5020 C0D6      008D8          77+         ST     R2,@001890             SAVE DATA ADDR INTO CCW          00350000
00089A 9209 C0D6      008D8          78+         MVI    @001890,X'09'          PRINT: SINGLE SPACE              00360000
00089E 5030 C0DA      008DC          79+         ST     R3,@001890+4           SAVE LENGTH INTO CCW             00370000
0008A2 4110 C0D6      008D8          80+         LA     R1,@001890             POINT TO CCW                     00380000
0008A6 5010 0048      00048          81+         ST     R1,72                  SAVE INTO CAW                    00390000
0008AA 4120 000E      0000E          82+         LA     R2,X'00E'              GET PRINT DEVICE ADDRESS         00400000
0008AE 9C00 2000      00000          83+         SIO    0(R2)                                                   00410000
0008B2 4770 C0CA      008CC          84+         BNZ    @001881                BRANCH IF ERROR                  00420000
0008B6                               85+@001802  DS     0H                                                      00430000
0008B6 9D00 2000      00000          86+         TIO    0(R2)                  WAIT FOR I/O TO COMPLETE         00440000
0008BA 4780 C0C4      008C6          87+         BZ     @001803                COMPLETE                         00450000
0008BE 4710 C0CE      008D0          88+         BC     1,@001882              BRANCH IF ERROR                  00460000                                                                                                               PAGE    4

  LOC  OBJECT CODE    ADDR1 ADDR2  STMT   SOURCE STATEMENT                                       ASM 0201 14.36 11/21/11

0008C2 47F0 C0B4      008B6          89+         B      @001802                LOOP BACK AND WAIT               00470000
                                     90+*                                                                       00480000
0008C6                               91+@001803  DS     0H                                                      00490000
0008C6 98EC D00C      0000C          92+         LM     R14,R12,12(R13)        RESTORE REGISTERS                00500000
0008CA 07FE                          93+         BR     R14                                                     00510000
                                     94+*                                                                       00520000
0008CC 8200 C3CE      00BD0          95+@001881  LPSW   @ERRPRT1               LOAD WAIT PSW                    00530000
0008D0 8200 C3D6      00BD8          96+@001882  LPSW   @ERRPRT2               LOAD WAIT PSW                    00540000
0008D8                               97+         DS     0D                                                      00550000
0008D8 0000000000000000              98+@001890  DC     X'00',AL3(0),X'00',X'00',AL2(0)  CCW                    00560000
                                     99          @CARD  GEN=YES                                                 00380000
0008E0 90EC D00C      0000C         100+@CARD    STM   R14,R12,12(R13)         SAVE CALLERS REGISTERS           00140000
0008E4 5010 C13E      00940         101+         ST    R1,@001990              SAVE BUFFER ADDR INTO CCW        00150000
0008E8 9202 C13E      00940         102+         MVI   @001990,X'02'           READ CARD                        00160000
0008EC 4120 0050      00050         103+         LA    R2,80                   DATA LENGTH                      00170000
0008F0 5020 C142      00944         104+         ST    R2,@001990+4            SAVE INTO CCW                    00180000
0008F4 4120 C13E      00940         105+         LA    R2,@001990              POINT TO CCW                     00190000
0008F8 5020 0048      00048         106+         ST    R2,72                   SAVE INTO CAW                    00200000
0008FC 4120 000C      0000C         107+         LA    R2,X'00C'                                                00360000
000900 9C00 2000      00000         108+         SIO   0(R2)                   START I/O                        00220000
000904 4770 C12C      0092E         109+         BNZ   @001903                 BRANCH IF ERROR                  00230000
000908                              110+@001901  DS    0H                                                       00240000
000908 9D00 2000      00000         111+         TIO   0(R2)                   WAIT FOR I/O TO COMPLETE         00250000
00090C 4780 C116      00918         112+         BZ    @001902                 COMPLETE                         00260000
000910 4710 C12C      0092E         113+         BC    1,@001903               ERROR                            00270000
000914 47F0 C106      00908         114+         B     @001901                                                  00280000
                                    115+*                                                                       00290000
000918                              116+@001902  DS    0H                                                       00300000
000918 41F0 0000      00000         117+         LA    R15,0                   SET RC                           00310000
00091C D501 C146 0044 00948 00044   118+         CLC   @001991,68              CHANNEL END + DEVICE END ?       00320000
000922 4780 C130      00932         119+         BE    @001904                 YES - RC=0                       00330000
000926 41F0 0008      00008         120+         LA    R15,8                   RC =8                            00340000
00092A 47F0 C130      00932         121+         B     @001904                                                  00350000
                                    122+*                                                                       00360000
00092E                              123+@001903  DS    0H                                                       00370000
00092E 41F0 0008      00008         124+         LA    R15,8                                                    00380000
000932                              125+@001904  DS    0H                                                       00390000
000932 58E0 D00C      0000C         126+         L     R14,12(,R13)           RESTORE R14                       00400000
000936 980C D014      00014         127+         LM    R0,R12,20(R13)         RESTORE R0-R12                    00410000
00093A 07FE                         128+         BR    R14                    RETURN TO CALLER                  00420000
                                    129+*                                                                       00430000
000940                              130+         DS    0D                                                       00440000
000940 0000000000000000             131+@001990  DC    X'00',AL3(0),X'00',X'00',AL2(0)   CCW                    00450000
000948 0C00                         132+@001991  DC    X'0C00'       CHANNEL END - DEVICE END                   00460000
                                                                                                               PAGE    5

  LOC  OBJECT CODE    ADDR1 ADDR2  STMT   SOURCE STATEMENT                                       ASM 0201 14.36 11/21/11

                                    133          @DUMP  GEN=YES                                                 00390000
00094A 90EC D00C      0000C         134+@DUMP    STM   R14,R12,12(R13)                                          00140000
00094E 41F0 C25E      00A60         135+         LA    R15,@002180        NEW SAVE AREA                         00150000
000952 50F0 D008      00008         136+         ST    R15,8(,R13)                                              00160000
000956 50D0 F004      00004         137+         ST    R13,4(,R15)                                              00170000
00095A 18DF                         138+         LR    R13,R15                                                  00180000
                                    139+*                                                                       00190000
00095C 18A1                         140+         LR    R10,R1             DATA ADDRESS                          00200000
00095E 18B0                         141+         LR    R11,R0             LENGTH                                00210000
000960 1ABA                         142+         AR    R11,R10            END ADDRESS                           00220000
                                    143+*                                                                       00230000
000962 54A0 C2B6      00AB8         144+         N     R10,@002183        ALIGN                                 00240000
000966                              145+@002101  DS    0H                                                       00250000
000966 9240 C1DA      009DC         146+         MVI   @002170,C' '       CLEAR PRINT BUFFER                    00260000
00096A D282 C1DB C1DA 009DD 009DC   147+         MVC   @002170+1(L'@002170-1),@002170                           00270000
000970 50A0 C2A6      00AA8         148+         ST    R10,@002181        ADDRESS                               00280000
000974 F384 C2AA C2A6 00AAC 00AA8   149+         UNPK  @002182(9),@002181(5)                                    00290000
00097A DC07 C2AA C2CA 00AAC 00ACC   150+         TR    @002182(8),@002199-C'0'                                  00300000
000980 D207 C1DA C2AA 009DC 00AAC   151+         MVC   @002171,@002182                                          00310000
                                    152+*                                                                       00320000
000986 D20F C209 A000 00A0B 00000   153+         MVC   @002174,0(R10)                                           00330000
00098C DC0F C209 C2BA 00A0B 00ABC   154+         TR    @002174,@002198    KEEP ONLY PRINTABLE                   00340000
                                    155+*                                                                       00350000
000992 4120 C1E4      009E6         156+         LA    R2,@002172         FIRST DATA AREA                       00360000
000996 4130 0004      00004         157+         LA    R3,4                                                     00370000
00099A                              158+@002102  DS    0H                                                       00380000
00099A D203 C2A6 A000 00AA8 00000   159+         MVC   @002181(4),0(R10)                                        00390000
0009A0 F384 C2AA C2A6 00AAC 00AA8   160+         UNPK  @002182(9),@002181(5)                                    00400000
0009A6 DC07 C2AA C2CA 00AAC 00ACC   161+         TR    @002182(8),@002199-C'0'                                  00410000
0009AC D207 2000 C2AA 00000 00AAC   162+         MVC   0(8,R2),@002182                                          00420000
0009B2 41A0 A004      00004         163+         LA    R10,4(,R10)                                              00430000
0009B6 4120 2009      00009         164+         LA    R2,9(,R2)                                                00440000
0009BA 4630 C198      0099A         165+         BCT   R3,@002102                                               00450000
                                    166+*                                                                       00460000
                                    167+*                                                                       00470000
0009BE 4110 C1DA      009DC         168+         LA    R1,@002170                                               00360000
0009C2 4100 0084      00084         169+         LA    R0,132                                                   00360000
0009C6 41F0 C080      00882         170+         LA     R15,@PRINT                                              00110000
0009CA 05EF                         171+         BALR   R14,R15                                                 00120000
                                    172+*                                                                       00490000
                                    173+*                                                                       00500000
0009CC 19AB                         174+         CR    R10,R11            STILL MORE TO DO                      00510000
0009CE 4740 C164      00966         175+         BL    @002101            YES - LOOP BACK                       00520000
                                    176+*                                                                       00530000                                                                                                               PAGE    6

  LOC  OBJECT CODE    ADDR1 ADDR2  STMT   SOURCE STATEMENT                                       ASM 0201 14.36 11/21/11

                                    177+*                                                                       00540000
0009D2 58D0 D004      00004         178+         L     R13,4(,R13)                                              00550000
0009D6 98EC D00C      0000C         179+         LM    R14,R12,12(R13)                                          00560000
0009DA 07FE                         180+         BR    R14                                                      00570000
                                    181+*                                                                       00580000
                                    182+*                                                                       00590000
0009DC 4040404040404040             183+@002170  DC    CL132' '                                                 00600000
000A60                      009DC   184+         ORG   @002170                                                  00610000
0009DC                              185+@002171  DS    CL8                                                      00620000
0009E4                              186+         DS    CL2                                                      00630000
0009E6                              187+@002172  DS    CL8,CL1,CL8,CL1,CL8,CL1,CL8,CL2                          00640000
000A0B                              188+@002174  DS    CL16                                                     00650000
000A1B                      00A60   189+         ORG   ,                                                        00660000
                                    190+*                                                                       00670000
000A60 0000000000000000             191+@002180  DC    18F'0'                                                   00680000
000AA8 00000000                     192+@002181  DC    F'0'                                                     00690000
000AAC F040404040404040             193+@002182  DC    CL9'0'                                                   00700000
000AB8                              194+         DS    0F                                                       00710000
000AB8 00FFFFF0                     195+@002183  DC    X'00FFFFF0'                                              00720000
                                    196+*                                                                       00730000
                                    197+*                                                                       00740000
000ABC                              198+@002198  DS    0C                                                       00750000
                                    199+*                 0 1 2 3 4 5 6 7 8 9 A B C D E F                       00760000
000ABC 4B4B4B4B4B4B4B4B             200+         DC    X'4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B'  00                  00770000
000ACC 4B4B4B4B4B4B4B4B             201+         DC    X'4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B'  10                  00780000
000ADC 4B4B4B4B4B4B4B4B             202+         DC    X'4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B'  20                  00790000
000AEC 4B4B4B4B4B4B4B4B             203+         DC    X'4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B'  30                  00800000
000AFC 4B4B4B4B4B4B4B4B             204+         DC    X'4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B'  40                  00810000
000B0C 504B4B4B4B4B4B4B             205+         DC    X'504B4B4B4B4B4B4B4B4B5A5B5C5D5E5F'  50                  00820000
000B1C 60614B4B4B4B4B4B             206+         DC    X'60614B4B4B4B4B4B4B4B6A6B6C6D6E6F'  60                  00830000
000B2C 4B4B4B4B4B4B4B4B             207+         DC    X'4B4B4B4B4B4B4B4B4B4B7A7B7C7D7E7F'  70                  00840000
000B3C 4BC1C2C3C4C5C6C7             208+         DC    X'4BC1C2C3C4C5C6C7C8C94B4B4B4B4B4B'  80                  00850000
000B4C 4BD1D2D3D4D5D6D7             209+         DC    X'4BD1D2D3D4D5D6D7D8D94B4B4B4B4B4B'  90                  00860000
000B5C 4B4BE2E3E4E5E6E7             210+         DC    X'4B4BE2E3E4E5E6E7E8E94B4B4B4B4B4B'  A0                  00870000
000B6C 4B4B4B4B4B4B4B4B             211+         DC    X'4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B4B'  B0                  00880000
000B7C 4BC1C2C3C4C5C6C7             212+         DC    X'4BC1C2C3C4C5C6C7C8C94B4B4B4B4B4B'  C0                  00890000
000B8C 4BD1D2D3D4D5D6D7             213+         DC    X'4BD1D2D3D4D5D6D7D8D94B4B4B4B4B4B'  D0                  00900000
000B9C 4B4BE2E3E4E5E6E7             214+         DC    X'4B4BE2E3E4E5E6E7E8E94B4B4B4B4B4B'  E0                  00910000
000BAC F0F1F2F3F4F5F6F7             215+         DC    X'F0F1F2F3F4F5F6F7F8F94B4B4B4B4B4B'  F0                  00920000
                                    216+*                                                                       00930000
                                    217+*                                                                       00940000
000BBC F0F1F2F3F4F5F6F7             218+@002199  DC    C'0123456789ABCDEF'                                      00950000
                                    219          @ERR  ,                                                        00400000
000BD0                              220+         DS   0D                                                        00030000                                                                                                               PAGE    7

  LOC  OBJECT CODE    ADDR1 ADDR2  STMT   SOURCE STATEMENT                                       ASM 0201 14.36 11/21/11

000BD0 0002000000BE0001             221+@ERRPRT1 DC   X'0002000000',X'BE0001'                                   00040000
000BD8 0002000000BE0002             222+@ERRPRT2 DC   X'0002000000',X'BE0002'                                   00050000
                                    223          @REGS ,                                                        00410000
                            00000   224+R0       EQU   0                                                        00030000
                            00001   225+R1       EQU   1                                                        00040000
                            00002   226+R2       EQU   2                                                        00050000
                            00003   227+R3       EQU   3                                                        00060000
                            00004   228+R4       EQU   4                                                        00070000
                            00005   229+R5       EQU   5                                                        00080000
                            00006   230+R6       EQU   6                                                        00090000
                            00007   231+R7       EQU   7                                                        00100000
                            00008   232+R8       EQU   8                                                        00110000
                            00009   233+R9       EQU   9                                                        00120000
                            0000A   234+R10      EQU   10                                                       00130000
                            0000B   235+R11      EQU   11                                                       00140000
                            0000C   236+R12      EQU   12                                                       00150000
                            0000D   237+R13      EQU   13                                                       00160000
                            0000E   238+R14      EQU   14                                                       00170000
                            0000F   239+R15      EQU   15                                                       00180000
                                    240 *                                                                       00420000
                                    241 **********************************************************************  00430000
                                    242 *                                                                       00440000
000BE0 6060606060606060             243 DASH     DC     C'--------------------------------------------------'   00450000
                                    244 *                                                                       00460000
                                    245 *                                                                       00470000
000C18                              246          DS     0D                                                      00480000
000C18 000200000099FACE             247 DONE     DC     X'0002000000',X'99FACE'                                 00490000
                                    248 *                                                                       00500000
000C20                              249 SAVEA    DS     18F                                                     00510000
                                    250 *                                                                       00520000
000C68                              251 INBUF    DS    CL80                                                     00530000
                                    252 *                                                                       00540000
                                    253          END   ,                                                        00550000
000CB8 C8C5D3D3D66B40E6             254                =C'HELLO, WORLD'
000CC4 00000800                     255                =A(BEGIN)
000CC8 40                           256                =C' '                                                  RELOCATION DICTIONARY                                        PAGE    8

POS.ID   REL.ID   FLAGS   ADDRESS                                                                ASM 0201 14.36 11/21/11

 0001     0001      08     000005
 0001     0001      0C     000CC4
                                                  CROSS-REFERENCE                                              PAGE    9

SYMBOL    LEN   VALUE   DEFN    REFERENCES                                                       ASM 0201 14.36 11/21/11

@CARD    00004 000008E0 00100  00026
@DUMP    00004 0000094A 00134  00060
@ERRPRT1 00005 00000BD0 00221  00095
@ERRPRT2 00005 00000BD8 00222  00096
@PRINT   00004 00000882 00069  00015 00020 00033 00042 00047 00052 00170
@001801  00002 00000896 00076  00074
@001802  00002 000008B6 00085  00089
@001803  00002 000008C6 00091  00087
@001881  00004 000008CC 00095  00084
@001882  00004 000008D0 00096  00088
@001890  00001 000008D8 00098  00077 00078 00079 00080
@001901  00002 00000908 00110  00114
@001902  00002 00000918 00116  00112
@001903  00002 0000092E 00123  00109 00113
@001904  00002 00000932 00125  00119 00121
@001990  00001 00000940 00131  00101 00102 00104 00105
@001991  00002 00000948 00132  00118
@002101  00002 00000966 00145  00175
@002102  00002 0000099A 00158  00165
@002170  00132 000009DC 00183  00146 00147 00147 00147 00168 00184
@002171  00008 000009DC 00185  00151
@002172  00008 000009E6 00187  00156
@002174  00016 00000A0B 00188  00153 00154
@002180  00004 00000A60 00191  00135
@002181  00004 00000AA8 00192  00148 00149 00159 00160
@002182  00009 00000AAC 00193  00149 00150 00151 00160 00161 00162
@002183  00004 00000AB8 00195  00144
@002198  00001 00000ABC 00198  00154
@002199  00016 00000BBC 00218  00150 00161
ABSTEST2 00001 00000000 00001  00005
BEGIN    00002 00000800 00007  00002 00255
DASH     00050 00000BE0 00243  00018 00019 00040 00041
DONE     00005 00000C18 00247  00064
INBUF    00080 00000C68 00251  00025 00031 00032
LOOP     00002 00000822 00023  00035
LOOPEND  00002 00000844 00038  00029
R0       00001 00000000 00224  00014 00019 00032 00041 00046 00051 00059 00071 00127 00141 00169
R1       00001 00000001 00225  00013 00018 00025 00031 00040 00045 00050 00058 00070 00072 00073 00075 00080 00081 00101
                               00140 00168
R10      00001 0000000A 00234  00140 00142 00144 00148 00153 00159 00163 00163 00174
R11      00001 0000000B 00235  00141 00142 00174
R12      00001 0000000C 00236  00007 00008 00069 00092 00100 00127 00134 00179
R13      00001 0000000D 00237  00010 00069 00092 00100 00126 00127 00134 00136 00137 00138 00178 00178 00179
R14      00001 0000000E 00238  00016 00021 00027 00034 00043 00048 00053 00061 00069 00092 00093 00100 00126 00128 00134                                                  CROSS-REFERENCE                                              PAGE   10

SYMBOL    LEN   VALUE   DEFN    REFERENCES                                                       ASM 0201 14.36 11/21/11

                               00171 00179 00180
R15      00001 0000000F 00239  00015 00016 00020 00021 00026 00027 00028 00028 00033 00034 00042 00043 00047 00048 00052
                               00053 00060 00061 00117 00120 00124 00135 00136 00137 00138 00170 00171
R2       00001 00000002 00226  00070 00077 00082 00083 00086 00103 00104 00105 00106 00107 00108 00111 00156 00162 00164
                               00164
R3       00001 00000003 00227  00071 00073 00075 00079 00157 00165
R5       00001 00000005 00229  00056 00058
SAVEA    00004 00000C20 00249  00010                                                  LITERAL CROSS-REFERENCE                                      PAGE   11

SYMBOL    LEN   VALUE   DEFN    REFERENCES                                                       ASM 0201 14.36 11/21/11

=C'HELLO, WORLD'
         00012 00000CB8 00254  00013
=A(BEGIN)
         00004 00000CC4 00255  00056
=C' '    00001 00000CC8 00256  00045 00050                                                  ASSEMBLER DIAGNOSTICS AND STATISTICS                         PAGE   12

                                                                                                 ASM 0201 14.36 11/21/11

NO STATEMENTS FLAGGED IN THIS ASSEMBLY
HIGHEST SEVERITY WAS    0
OPTIONS FOR THIS ASSEMBLY
  ALIGN, ALOGIC, BUFSIZE(STD), DECK, ESD, FLAG(0), LINECOUNT(44), LIST, NOMCALL, YFLAG, WORKSIZE(2097152)
  NOMLOGIC, NONUMBER, NOOBJECT, NORENT, RLD, NOSTMT, NOLIBMAC, NOTERMINAL, NOTEST, XREF(SHORT)
  SYSPARM()
WORK FILE BUFFER SIZE/NUMBER =19066/ 1
TOTAL RECORDS READ FROM SYSTEM INPUT         55
TOTAL RECORDS READ FROM SYSTEM LIBRARY      271
TOTAL RECORDS PUNCHED                        26
TOTAL RECORDS PRINTED                       352

[Next – ABSTEST2 JCL]

Testing The Macros – ABSTEST2

Now we can write a short program to test our macros.

ABSTEST2 START 0                                      
WAITPSW  DC    X'0000000000',AL3(BEGIN)               
*                                                     
*                                                     
         ORG   ABSTEST2+2048                          
*                                                     
BEGIN    BALR  R12,0         SET BASE REGISTER        
         USING *,R12                                  
*                                                     
         LA    R13,SAVEA     FIRST SAVE AREA

We start by loading a PSW at location zero.  Our PSW will start executing at lable BEGIN.  Because the lower byes in memory are used for communication between the CPU  and the operating system software we need to load  our executable program in higher memory.  Using the ORG statement we will being our program at 2K (2048).

We begin by establishing register 12 as a base register and placing our initial save area address into register 13.

         @PRINT 'HELLO, WORLD'   PRINT "HELLO WORLD"                  
         @PRINT DASH,LEN=L'DASH  PRINT A LINE OF DASHES               
*                                                                     
LOOP     DS    0H                                                     
         @CARD INBUF             READ A CARD                          
         LTR   R15,R15           CHECK FOR GOOD READ                  
         BNZ   LOOPEND                                                
         @PRINT INBUF,LEN=L'INBUF    PRINT THE CARD                   
         B     LOOP              LOOP BACK FOR ANOTHER CARD           
*                                                                     
*                                                                     
LOOPEND  DS    0H                                                     
         @PRINT DASH,LEN=L'DASH  PRINT A LINE OF DASHES               
         @PRINT ' '              PRINT BLANK                          
         @PRINT ' '                         LINES                     
*                                                                     
*                                                                     
         L      R5,=A(BEGIN)                                          
         @DUMP  (R5),128         DUMP SOME STORAGE
*
         LPSW   DONE

Now we use our @CARD macro to read from the card reader.  We check the return code in register 15 to see if a card was read.  If not we branch out of the loop.  If a card was read we print using the @PRINT  macro and then loop back an attempt to read another card.

After reading the last card we print a line of dashes an two blank lines.  We then test the @DUMP macro by dumping 128 bytes of our executable program.  We then load a wait state PSW to end execution.

          @PRINT GEN=YES                                            
          @CARD  GEN=YES                                            
          @DUMP  GEN=YES                                            
          @ERR  ,                                                   
          @REGS ,                                                   
 *                                                                  
 *******************************************************************
 *                                                                  
 DASH     DC     C'-------------------------------------------------
 *                                                                  
 *                                                                  
          DS     0D                                                 
 DONE     DC     X'0002000000',X'99FACE'                            
 *                                                                  
 SAVEA    DS     18F                                                
 *                                                                  
 INBUF    DS    CL80                                                
 *                                                                  
          END   ,

Now we include the GEN=YES forms of our @CARD, @PRINT and @DUMP macros to generate the subroutine code.  We also use the @ERR and @REGS macros to define our error codes and registers.

Our data areas include a line of dashes, a PSW with the wait bit set, a save area and an input buffer.

[Next – ABSTEST2 Assembly Listing]

Macro – @CARD

Now we will create a macro to read a card from the card reader.

        
         MACRO
&NAME    @CARD &BUF,&DEV=X'00C',&GEN=NO
         LCLC  &NDX
&NDX     SETC  '&SYSNDX'
         AIF   ('&GEN' EQ 'YES').GEN
.*
&NAME    @RGCK &BUF,REG=R1
         LA    R15,@CARD
         BALR  R14,R15
         MEXIT ,
.*

We start off very much the same as our other macros.  We pass the address of an 80 byte buffer to read the card data into.  The default device address for the card reader is x’00c’.  We also have the two forms of the macro GEN=YES/No.

We use @RGCK to get the buffer address into register 1 and then all our @CARD subroutine.

.GEN     ANOP  ,
@CARD    STM   R14,R12,12(R13)         SAVE CALLERS REGISTERS
         ST    R1,@&NDX.90             SAVE BUFFER ADDR INTO CCW
         MVI   @&NDX.90,X'02'          READ CARD
         LA    R2,80                   DATA LENGTH
         ST    R2,@&NDX.90+4           SAVE INTO CCW
         LA    R2,@&NDX.90             POINT TO CCW
         ST    R2,72                   SAVE INTO CAW
         @RGCK &DEV,REG=R2             DEVICE ADDRESS
         SIO   0(R2)                   START I/O
         BNZ   @&NDX.03                BRANCH IF ERROR

The @CARD subroutine starts by saving the caller’s registers.  We then start building the CCW by storing the buffer address.  We set the CCW opcode to X’02’ to read a card and set the data length to 80.

After saving the CCW address into the CAW we issue the SIO and check to see if it was accepted.

@&NDX.01 DS    0H
         TIO   0(R2)                   WAIT FOR I/O TO COMPLETE
         BZ    @&NDX.02                COMPLETE
         BC    1,@&NDX.03              ERROR
         B     @&NDX.01
*
@&NDX.02 DS    0H
         LA    R15,0                   SET RC
         CLC   @&NDX.91,68             CHANNEL END + DEVICE END ?
         BE    @&NDX.04                YES - RC=0
         LA    R15,8                   RC =8
         B     @&NDX.04

We use a TIO loop to wait for the I/O to complete and then check to the CSW for normal completion (Only Channel End + Device End).  If there are no error conditions we will return to the caller with a return code of 0.  For any type of exceptional condition we will return a value of 8.

@&NDX.03 DS    0H
         LA    R15,8
@&NDX.04 DS    0H
         L     R14,12(,R13)           RESTORE R14
         LM    R0,R12,20(R13)         RESTORE R0-R12
         BR    R14                    RETURN TO CALLER
 *
         DS    0D
@&NDX.90 DC    X'00',AL3(0),X'00',X'00',AL2(0)   CCW
@&NDX.91 DC    X'0C00'       CHANNEL END - DEVICE END
         MEND  ,

When we reach label @&NDX.04 we have our return code loaded into register 15.  Now we need to restore all the registers except R15 so we don’t wipe out our return code value.

Full Macro Listing Below:


         MACRO                                                       
&NAME    @CARD &BUF,&DEV=X'00C',&GEN=NO                              
         LCLC  &NDX                                                  
&NDX     SETC  '&SYSNDX'                                             
         AIF   ('&GEN' EQ 'YES').GEN                                 
.*                                                                   
&NAME    @RGCK &BUF,REG=R1                                           
         LA    R15,@CARD                                             
         BALR  R14,R15                                               
         MEXIT ,                                                     
.*                                                                   
.*                                                                   
.GEN     ANOP  ,                                                     
@CARD    STM   R14,R12,12(R13)         SAVE CALLERS REGISTERS        
         ST    R1,@&NDX.90             SAVE BUFFER ADDR INTO CCW     
         MVI   @&NDX.90,X'02'          READ CARD                     
         LA    R2,80                   DATA LENGTH                   
         ST    R2,@&NDX.90+4           SAVE INTO CCW                 
         LA    R2,@&NDX.90             POINT TO CCW                  
         ST    R2,72                   SAVE INTO CAW                 
         @RGCK &DEV,REG=R2             DEVICE ADDRESS  
         SIO   0(R2)                   START I/O                      
         BNZ   @&NDX.03                BRANCH IF ERROR                
@&NDX.01 DS    0H                                                     
         TIO   0(R2)                   WAIT FOR I/O TO COMPLETE       
         BZ    @&NDX.02                COMPLETE                       
         BC    1,@&NDX.03              ERROR                          
         B     @&NDX.01                                               
*                                                                     
@&NDX.02 DS    0H                                                     
         LA    R15,0                   SET RC                         
         CLC   @&NDX.91,68             CHANNEL END + DEVICE END ?     
         BE    @&NDX.04                YES - RC=0                     
         LA    R15,8                   RC =8                          
         B     @&NDX.04                                               
*                                                                     
@&NDX.03 DS    0H                                                     
         LA    R15,8                                                  
@&NDX.04 DS    0H                                                     
         L     R14,12(,R13)           RESTORE R14                     
         LM    R0,R12,20(R13)         RESTORE R0-R12                  
         BR    R14                    RETURN TO CALLER               
 *                                                                   
         DS    0D                                                   
@&NDX.90 DC    X'00',AL3(0),X'00',X'00',AL2(0)   CCW                
@&NDX.91 DC    X'0C00'       CHANNEL END - DEVICE END               
         MEND  ,


[Next – Testing The Macros – ABSTEST2]