	SUBROUTINE PLTINI(PLTONX)
	INCLUDE 'SYSREP.PRM'
	COMMON/PLTDAT/ PLT(20,49),PLTON,PLTD(4,20,49)
C
C	--INITIALIZE ALL PLOTTING ROUTINES
C
	PLTON = PLTONX
	DO 10 I1 = 1,20
	DO 10 I2 = 1,49
10	PLT(I1,I2) = -2
	DO 20 I1 = 1,NUMDSK
	DO 20 I2 = 1,20
	DO 20 I3 = 1,49
20	PLTD(I1,I2,I3) = -2
	RETURN
	END
	SUBROUTINE PLTIT(ITEM,IDX)
	INCLUDE 'SYSREP.PRM'
	COMMON/PLTDAT/ PLT(20,49),PLTON,PLTD(4,20,49)
	REAL P,P1
C
C	--PUT DATA IN PLT ARRAY
C
	MIN = REC000(10,2)
	IF ((MIN .GE. 29) .AND. (MIN .LE. 31)) GOTO 10
	IF ((MIN .GE. 59) .OR. (MIN .LE. 01)) GOTO 20
	RETURN
10	P = 0.5
	GOTO 30
20	P = 0.0
C
C	--MAKE ARRAY INDEX
C
30	P1 = (FLOAT(REC000(9,2))+P)*2.0
	POS = IFIX(P1)
	IF (POS .EQ. 0) POS = 49
	IF ((POS .LT. 1) .OR. (POS .GT. 49)) RETURN
	PLT(IDX,POS) = ITEM
	RETURN
	END
	SUBROUTINE PLTOUT
	INCLUDE 'SYSREP.PRM'
	COMMON/HALSTF/ KRASH,KERROR
	COMMON/PLTX/ PLTST(30)
	COMMON/PLTDAT/ PLT(20,49),PLTON,PLTD(4,20,49)
	COMMON/FILE/ FNAME
	DOUBLE PRECISION FNAME,FN
50	FORMAT(A6,'.WEK')
40	FORMAT(A6,A4)
	DECODE(10,40,FNAME) FN,EN
	ENCODE(10,50,FNAME) FN
C
C	--OUTPUT PLOT FILES
C
	OPEN(UNIT=23,FILE=FNAME,MODE='IMAGE',ACCESS='SEQOUT')
	IF (PLTON .NE. 0) OPEN(UNIT=24,FILE='PLTDAT',MODE='IMAGE'
	1,ACCESS='SEQOUT')
	PLTST(4) = KERROR
	PLTST(5) = KRASH
	DO 20 I1 = 1,30
	IF (PLTON .NE. 0) WRITE(24) PLTST(I1)
20	WRITE(23) PLTST(I1)
	DO 10 I1 = 1,20
	DO 10 I2 = 1,49
	IF (PLTON .NE. 0) WRITE(24) PLT(I1,I2)
10	WRITE(23) PLT(I1,I2)
	DO 30 I1 = 1,NUMDSK
	DO 30 I2 = 1,20
	DO 30 I3 = 1,49
	IF (PLTON .NE. 0) WRITE(24) PLTD(I1,I2,I3)
30	WRITE(23) PLTD(I1,I2,I3)
	CLOSE(UNIT=23)
	IF (PLTON .NE. 0) CLOSE(UNIT=24)
	RETURN
	END
	SUBROUTINE PLTFIL
	INCLUDE 'SYSREP.PRM'
	COMMON/PLTX/ PLTST(30)
	PLTST(1) = REC000(6,1) !YEAR
	PLTST(2) = REC000(7,1) !MONTH
	PLTST(3) = REC000(8,1) !DAY
	RETURN
	END
	SUBROUTINE PLTDK(ITEM,UNIT,IDX)
	INCLUDE 'SYSREP.PRM'
	COMMON/PLTDAT/ PLT(20,49),PLTON,PLTD(4,20,49)
	REAL P,P1
C
C	--PUT DATA IN PLT ARRAY
C
C	--CHECK IF VALID FIRST
C
	MIN = REC000(10,2)
	IF ((MIN .GE. 29) .AND. (MIN .LE. 31)) GOTO 10
	IF ((MIN .GE. 59) .OR. (MIN .LE. 01)) GOTO 20
	RETURN
10	P = 0.5
	GOTO 30
20	P = 0.0
C
C	--MAKE ARRAY INDEX
C
30	P1 = (FLOAT(REC000(9,2))+P)*2.0
	POS = IFIX(P1)
	IF ((POS .LT. 1) .OR. (POS .GT. 49)) RETURN
	PLTD(UNIT,IDX,POS) = ITEM
	RETURN
	END

