.TITLE VDQIO--LOG VIRTUAL DISKS QIO SCORES .IDENT /V1.0/ .ENABLE LC ; ;****************************************************************************** ; ; This software is provided on an "as is" basis only. Caterpillar Tractor Co., ; disclaims all warranties on the program, including without limitation, all ; implied warranties of merchantablity and fitness. ; ; Full permission and consent is hereby given to DECUS and to the DECUS ; special interest groups to reproduce, distribute, and publish and permit ; others to reproduce in whole or in part, in any form and without restriction ; this program and any information relating thereto ; ;****************************************************************************** ; .MCALL EXIT$S,QIOW$,DIR$,DCBDF$ .MCALL FSRSZ$, FDBDF$, FDAT$A, FDRC$A, FDOP$A, FDBF$A .MCALL OPEN$A, OPEN$R, OPEN$W, CLOSE$, PUT$, GET$ .MCALL GTIM$C DCBDF$ ;define DCB offsets FSRSZ$ 1 FDB: FDBDF$ ;allocate file descriptor block FDAT$A R.VAR ;file is variable length record FDRC$A ,UBUF,256. ; FDOP$A 1,DSB,,FO.APD ;open file for append DSB: .WORD 4 .WORD DEVNM .WORD 9. .WORD DIRNM .WORD 9. .WORD FILNM DEVNM: .ASCII /LB0:/ .EVEN DIRNM: .ASCII /[200,001]/ .EVEN FILNM: .ASCII /VDQIO.LOG/ .EVEN FDB2: FDBDF$ ;allocate file descriptor block FDOP$A 2,DSB2 ; FDBF$A 31. ; DSB2: .WORD 4 .WORD DEVNM .WORD 9. .WORD DIRNM .WORD 9. .WORD FILNM2 FILNM2: .ASCII /VDQIO.OLD/ .EVEN UBUF: .BLKB 256. DATBUF: .BLKW 8. QOUT: QIOW$ IO.WVB,5,1,,,, OUTBUF: .ASCII /VDQIO--FAILED TO OPEN LOG FILE/ QLEN=.-OUTBUF .EVEN ISTRNG: .ASCIZ /VDQIO -- FCS ERROR %O/ .EVEN ; ; Find virtual disk DCB (if there is one). ; START: GTIM$C DATBUF ;get time MOV $DEVHD,R4 ;get start of DCB'S FIND: CMP D.NAM(R4),#"VD ;virtual disk DCB? BEQ 1$ ;branch if yes MOV D.LNK(R4),R4 ;get next DCB BNE FIND ;try again if there are more JMP DONE ;otherwise just give up 1$: MOV D.UCB(R4),R5 ;get 1st UCB addr MOVB D.UNIT(R4),R0 ;get lowest unit number MOVB D.UNIT+1(R4),R3 ;get highest unit number SUB R0,R3 ;get # units - 1 INC R3 ;R3 = # units ; ; Have found virtual disks so open file VDQIO.LOG for append. ; OPEN$R #FDB ;open file BCS NEWFIL ;branch if unsuccessful ; ; Have successufully opened existing file, so now see if the date ; has changed, and if so open a new file. ; GET$ #FDB,#UBUF ;get 1st record in file MOV #UBUF,R0 MOV #DATBUF,R1 MOV #3,R2 3$: CMP (R0)+,(R1)+ BNE 4$ ;branch if date has changed SOB R2,3$ CLOSE$ #FDB OPEN$A #FDB JMP LOAD 4$: CLOSE$ #FDB ;close existing file MOV #FDB,R0 MOV #FDB2,R1 CALL .RENAM ; ; If here need to open a new file ; NEWFIL: OPEN$W #FDB ;try to open a new file BCC STAMP ;branch if successful MOV #OUTBUF,R0 MOV #ISTRNG,R1 MOV #FDB+F.ERR,R2 CALL $EDMSG MOV R1,QOUT+Q.IOPL+2 DIR$ #QOUT ;output error message JMP DONE ;exit STAMP: MOV #DATBUF,R0 ;get time & date MOV #UBUF,R1 ;get user buffer MOV #6,R2 ;get # words to transfer 2$: MOV (R0)+,(R1)+ ;store time & date SOB R2,2$ ;loop till all values stored PUT$ #FDB,#UBUF,#6 ;write out time & date stamp ; ; Have successfully opened file so update it. ; LOAD: MOV #DATBUF+6,R0 ;get time parameters MOV #UBUF,R1 ;get user buffer MOV (R0)+,(R1)+ ;store time stamp MOV (R0)+,(R1)+ ; " " " MOV (R0)+,(R1)+ ; " " " LOOP: MOVB U.UNIT(R5),(R1)+ ;store unit number MOVB #0,(R1)+ ;clear out high byte of unit number MOV U.QIO(R5),(R1)+ ;store QIO count MOV U.QIO+2(R5),(R1)+ ; " " " ADD D.UCBL(R4),R5 ;point to next UCB SOB R3,LOOP ;decrement UCB counter SUB #UBUF,R1 ;get length of record PUT$ #FDB,#UBUF,R1 ;output record CLOSE$ #FDB ;close file DONE: EXIT$S .END START