C*	DSMMN	- MAIN ROUTINE FOR DISK STORAGE MONITOR
C
C 11/21/79	LEN	- ADDED NWSTAT FOR ISTAT RECORD SIZE AND ADDED
C		CALL TO DSMCHK TO CHECK DISK ALLOCATION RECORDS.
C 12/10/79	LEN	- REMOVED DB1: FROM LIST OF DEVICES
C
	PROGRAM DSM
C
	INCLUDE 'DSMCM.COM'
C
	DATA IDEV/'DB',0, 'DB',2, 0,0/
	DATA MAXDEV/2/, MAXUIC/150/, IDTTM/9*'  '/
C
	CALL DATE (IDTTM)
	CALL TIME (IDTTM(6))
C
	CALL DSMPRS (ISTDEV, IENDEV)
C
	DO 400 NDEV = ISTDEV, IENDEV
D	GO TO 400
D9000	CONTINUE
	IUDEV = IDEV(1,NDEV)
	IUNIT = IDEV(2,NDEV)
	NFO = 0
	NERUIC = 0
	CALL SIVFL (0, ISTAT, NWSTAT*MAXUIC)
	KSA	= 0
	KSU	= 0
	NFILSU	= 0
	CALL DSMUIC (NDEV)
	CALL DSMTB (NDEV)
C
C	PRINT OUT TOTALS, IF REALTIME SKIP OUTPUT TO PRINTER
C
	IF (LALL) GO TO 250
	WRITE (6, 505) IDTTM
 505	FORMAT (/' DISK STORAGE SUMMARY AS OF ',9A2,/)
	DO 200 I=1, NFO
	CALL DSMOT (ISTAT(1,I), ISTAT(3,I), ISTAT(5,I), ISTAT(7,I),
	1	KSU, KSA, NFILSU)
 200	CONTINUE
	WRITE (6, 500) KSU, KSA, NFILSU
 500	FORMAT (/' TOTAL OF',7X,I6,'./',I6,'. BLOCKS IN',I6,'. FILE(S)'/)
C
 250	CONTINUE
	IF (NERUIC .NE. 0) WRITE (6, 520) NERUIC
 520	FORMAT (/' ',I3, ' UIC''S COULD NOT FIT IN ISTAT TABLE',
	1	' REBUILD DSM WITH LARGER MAXUIC SIZE')
	IF (.NOT. LALL) GO TO 400
C
C	COPY STATS TO LB0:[1,1]DSMNOT.DAT FOR ...NOT ON LOGIN
C
	NRTB = NRTB - 1
	CALL X1DW (FIDTB, NRTB, 1, NFO)
	CALL X1DW (FIDTB, NRTB, 1, IUDEV)
	CALL X1DW (FIDTB, NRTB, 1, IUNIT)
	DO 300 I=1, NFO
	CALL X1DW (FIDTB, NRTB, NWSTAT, ISTAT(1,I))
 300	CONTINUE
	CALL X1DW (FIDTB, NRTB, 1, 0)
C
 400	CONTINUE
C
C	CHECK THE ALLOCATIONS IF IN FULL SUMMARY MODE
	IF (LALL) CALL DSMCHK
	IF (LALL) CALL X1EF (FIDTB)
C
	END
