	PROGRAM VFYDEV
C THIS PROGRAM IS PART OF A DEVICE VERIFY SYSTEM
	LOGICAL*1 DEV1(3),DEV2(3),LINE(80)
	LOGICAL*1 DIR1(400,15),DIR2(400,15),TEMP(400,15)
	INTEGER*2 NEQ,IPNTRS(400,2)
	COMMON TEMP,NEQ,IPNTRS,DIR1,DIR2
	CALL ASSIGN(1,'GETDIR.COM',0,'OLD','NC',1)
	REWIND 1
	READ (1,100)DEV1
	READ (1,100)DEV2
100	FORMAT(31X,3A1)
	CALL CLOSE(1)
	REWIND 1
	CALL GETDIR('DEV1.DIR',DIR1,LIM1)
	CALL GETDIR('DEV2.DIR',DIR2,LIM2)
	CALL CMPDIR(DEV1,DIR1,DIR2,LIM1,LIM2)
	CALL CMPDIR(DEV2,DIR2,DIR1,LIM2,LIM1)
	CALL CMPFIL(DEV1,DEV2,DIR1,DIR2,NEQ,IPNTRS)
	STOP
	END
	SUBROUTINE GETDIR(FILE,DIR,LIM)
	LOGICAL*1 DIR(400,15)
	LOGICAL*1 FILE(8),TEMP1(7),TEMP2(7)
	INTEGER*2 ISIZE,JSIZE
D	WRITE(7,666)FILE
666	FORMAT(' FILE IS ',8A1)
C SET UP FOR EITHER DEV1.DIR OR DEV2.DIR
	CALL ASSIGN(1,FILE,0,'OLD','NC',1)
	REWIND 1
	READ(1,100)ITEMP	! SKIP DATE FIELD OF DIR
	LIM=1
	LIM2=201
5	READ(1,100)(DIR(LIM,J),J=1,10),ISIZE,TEMP1
     +     ,       (DIR(LIM2,K),K=1,10),JSIZE,TEMP2
100	FORMAT(2(10A1,1X,I5,1X,2A1,1X,3A1,1X,2A1,6X))
	IS1=ISIZE/128
	IS2=ISIZE-(IS1*128)
	JS1=JSIZE/128
	JS2=JSIZE-(JS1*128)
	DIR(LIM,14)=IS1
	DIR(LIM,15)=IS2
	DIR(LIM2,14)=JS1
	DIR(LIM2,15)=JS2
	DIR(LIM,11)=IDIG2(TEMP1(6))
	DIR(LIM2,11)=IDIG2(TEMP2(6))
	DIR(LIM,12)=IDATVL(TEMP1(3))
	DIR(LIM2,12)=IDATVL(TEMP2(3))
	DIR(LIM,13)=IDIG2(TEMP1(1))
	DIR(LIM2,13)=IDIG2(TEMP2(1))
D	WRITE(7,333)(DIR(LIM,K),K=1,13),(DIR(LIM2,L),L=1,13)
333	FORMAT(2(1X,10A1,1X,3I3))
C	WRITE(7,444)TEMP1,TEMP2
444	FORMAT(1X,7A1,1X,7A1)
	IF(DIR(LIM,1).EQ."40)GO TO 1000
	LIM=LIM+1
	IF(DIR(LIM2,1).EQ."40)GO TO 2000
	LIM2=LIM2+1
	GO TO 5
1000	LIM=LIM-1
	GO TO 2001
2000	LIM1=LIM1-1
2001	CALL	CLOSE(1)
	REWIND 1
	DO 2005 I=201,LIM2
	LIM=LIM+1
		DO 2006 J=1,15
		DIR(LIM,J)=DIR(I,J)
2006	CONTINUE
2005	CONTINUE
	RETURN
	END
	SUBROUTINE CMPDIR(DEV,DIR1,DIR2,LIM1,LIM2)
	LOGICAL*1 DEV(3),DIR1(400,15),DIR2(400,15)
	LOGICAL*1 TEMP(400,15)
	INTEGER*2 NEQ,IPNTRS(400,2)
	COMMON TEMP,NEQ,IPNTRS
	NEQ=1
	IND=1
	IN1=1
	IN2=1
5	IREL=ITEST(DIR1,DIR2,IN1,IN2)
	IF(IREL.GT.0)GO TO 10
	IF(IREL.EQ.0)GO TO 20
C
C	GT IMPLIES IT DOESNT EXIST ON THE OTHER DEVICE
C
	DO 7 I=1,10
7	TEMP(IND,I)=DIR1(IN1,I)
C	WE JUST MOVED THE FILE NAME
C
	IND=IND+1
C	UPDATE THE TEMP AREA POINTER
C
	IN1=IN1+1
9	IF(IN1.LE.LIM1)GO TO 5
C
	WRITE(7,11)DEV
11	FORMAT(/' THE FOLLOWING FILES RESIDE ON ',3A1,' ONLY',/)
C
	IND=IND-1
	WRITE(7,12)((TEMP(I,J),J=1,10),I=1,IND)
12	FORMAT(7(2X,10A1))
	RETURN
C
10	IN2=IN2+1
C
C	CHECK THAT WE DONT OVERRUN LIST
C
	IF(IN2.LE.LIM2)GO TO 5
C
C	OTHERWISE MOVE THE REST OVER
C
	DO 13 I=IN1,LIM1
		DO 14 J=1,10
14		TEMP(IND,J)=DIR1(IN1,J)
C
	IND=IND+1
13	CONTINUE
	IN1=LIM1+1
C 	DONE FLAG
	GO TO 9
C
C	FILE NAMES ARE THE SAME
C
20	IPNTRS(NEQ,2)=IN1
	IPNTRS(NEQ,1)=IN2
	NEQ=NEQ+1
	IN1=IN1+1
	IN2=IN2+1
	GO TO 9
	END
	FUNCTION ITEST(DIR1,DIR2,IN1,IN2)
	LOGICAL*1 DIR1(400,15),DIR2(400,15)
	ITEST=0
C	DEFAULT IS EQUAL
	DO 5 I=8,10
	J=I
	IF(DIR1(IN1,I).NE.DIR2(IN2,I))GO TO 50
5	CONTINUE
C
C	WE JUST COMPARED THE EXTENSION
C
	DO 10 I=1,6
	J=I
	IF(DIR1(IN1,I).NE.DIR2(IN2,I))GO TO 50
10	CONTINUE
	RETURN
C
C	IF WE RETURN THEY ARE THE SAME
C
50	IF(DIR1(IN1,J).EQ."40)IVAL1=0
	IF(DIR1(IN1,J).GE.'A')IVAL1=DIR1(IN1,J)-64
	IF(DIR1(IN1,J).GE.'0'.AND.DIR1(IN1,J).LE.'9')IVAL1=DIR1(IN1,J)
     +		-"60+27
	IF(DIR2(IN2,J).EQ.' ')IVAL2=0
	IF(DIR2(IN2,J).GE.'A')IVAL2=DIR2(IN2,J)-64
	IF(DIR2(IN2,J).GE.'0'.AND.DIR2(IN2,J).LE.'9')IVAL2=DIR2(IN2,J)
     +		-"60+27
	ITEST=-1
	IF(IVAL1.GT.IVAL2)ITEST=1
	RETURN
	END
	FUNCTION IDATVL(TMP)
	LOGICAL*1 TMP(3)
	INTEGER*2 FLAG,VALS(12)
	DATA FLAG/0/
	IF(FLAG.EQ.0)CALL SETVAL(VALS)
	FLAG=1
	IVAL=0
	DO 5 I=1,3
	IVAL=IVAL*27+(TMP(I).AND."37)
5	CONTINUE
	DO 10 I=1,12
	J=I
	IF(IVAL.EQ.VALS(I))GO TO 20
10	CONTINUE
	IDATVL=13
	RETURN
20	IDATVL=J
	RETURN
	END
	SUBROUTINE SETVAL(VALS)
	INTEGER VALS(12)
	VAL(ICH)=ICH-"100
	VALS(1)=27*27*VAL('J')+27*VAL('A')+VAL('N')
	VALS(2)=27*27*VAL('F')+27*VAL('E')+VAL('B')
	VALS(3)=27*27*VAL('M')+27*VAL('A')+VAL('R')
	VALS(4)=27*27*VAL('A')+27*VAL('P')+VAL('R')
	VALS(5)=27*27*VAL('M')+27*VAL('A')+VAL('Y')
	VALS(6)=27*27*VAL('J')+27*VAL('U')+VAL('N')
	VALS(7)=27*27*VAL('J')+27*VAL('U')+VAL('L')
	VALS(8)=27*27*VAL('A')+27*VAL('U')+VAL('G')
	VALS(9)=27*27*VAL('S')+27*VAL('E')+VAL('P')
	VALS(10)=27*27*VAL('O')+27*VAL('C')+VAL('T')
	VALS(11)=27*27*VAL('N')+27*VAL('O')+VAL('V')
	VALS(12)=27*27*VAL('D')+27*VAL('E')+VAL('C')
	RETURN
	END
	FUNCTION IDIG2(IST)
	LOGICAL*1 IST(2)
	IDIG2=0
	ID1=IST(1).AND."17
	ID2=IST(2).AND."17
	IDIG2=10*ID1+ID2
	IF(IDIG2.GE.0.AND.IDIG2.LT.100)RETURN
	WRITE(7,5)IST,IDIG2
5	FORMAT(' ERROR IN IDIG2 ',2A1,1X,I6)
	STOP
	END
	SUBROUTINE CMPFIL(DEV1,DEV2,DIR1,DIR2,NEQ,IPTR)
	LOGICAL*1 DEV1(3),DEV2(3),DIR1(400,15),DIR2(400,15)
	LOGICAL*1 TEMP(400,15)
	INTEGER*2 NQ,IPNTRS(400,2)
	COMMON TEMP,NQ,IPNTRS
	LOGICAL*1 FILE1(15),FILE2(15),SAME(4),DIFFER(6)
	INTEGER*2 BUF1(256),BUF2(256)
	DATA SAME/'S','A','M','E'/
	DATA DIFFER/'D','I','F','F','E','R'/
	NEQ=NEQ-1
	WRITE(7,1)
1	FORMAT(/,' THE FOLLOWING FILES RESIDE ON BOTH DEVICES')
	WRITE(7,2)DEV1,DEV2
2	FORMAT(/,5X,'FILE NAME ',2(2X,3A1,' DATE SIZE'))
	WRITE(7,3)
3	FORMAT(5X,'----------',2X,'-------------',2X,'-------------')
	DO 5 I=1,NEQ
	IPT=1
	JPT=1
		IND1=IPNTRS(I,1)
		IND2=IPNTRS(I,2)
C	CLEAR OUT MONTH IF IT WAS BLANK
	IF(DIR1(IND1,12).EQ.13)DIR1(IND1,12)=0
	IF(DIR2(IND2,12).EQ.13)DIR2(IND2,12)=0
		DO 10 J=1,3
			FILE1(IPT)=DEV1(J)
			FILE2(JPT)=DEV2(J)
			IF(FILE1(IPT).NE."40)IPT=IPT+1
			IF(FILE2(JPT).NE."40)JPT=JPT+1
C	MOV DEVICE TO FILE SPEC
10		CONTINUE
C
		FILE1(IPT)=':'
		FILE2(JPT)=':'
		IPT=IPT+1
		JPT=JPT+1
		DO 15 J=1,10
			FILE1(IPT)=DIR1(IND1,J)
			FILE2(JPT)=DIR2(IND2,J)
			IF(FILE1(IPT).NE."40)IPT=IPT+1
			IF(FILE2(JPT).NE."40)JPT=JPT+1
15		CONTINUE
	FILE1(IPT)=0
	ISIZE=DIR1(IND1,14)*128+DIR1(IND1,15)
	JSIZE=DIR2(IND2,14)*128+DIR2(IND2,15)
	FILE2(JPT)=0
C	FILE SPECIFICATION READY
C
	CALL ASSIGN(1,FILE1,0,'OLD','NC',1)
	CALL ASSIGN(2,FILE2,0,'OLD','NC',1)
	REWIND 1
	REWIND 2
	NREC1=1
	NREC2=1
	DEFINE FILE 1(ISIZE,256,U,NREC1)
	DEFINE FILE 2(JSIZE,256,U,NREC2)
20	READ(1'NREC1,ERR=1000,END=1000)(BUF1(L),L=1,256)
	READ(2'NREC2,ERR=200,END=200)(BUF2(L),L=1,256)
		DO 25 L=1,256
		IF(BUF1(L).NE.BUF2(L))GO TO 200
25	CONTINUE
	GO TO 20
C
1000	READ(2'NREC2,ERR=1005,END=1005)(BUF2(L),L=1,256)
	GO TO 200
1005	WRITE(7,1006)I,(DIR1(IND1,L),L=1,13),ISIZE,
     +     (DIR2(IND2,M),M=11,13),JSIZE,SAME
1006	FORMAT(I4,1X,10A1,2(2X,I2,'/',I2,'/',I2,I5),2X,6A1)
	GO TO 300
200	WRITE(7,1006)I,(DIR1(IND1,L),L=1,13),ISIZE,
     +     (DIR2(IND2,M),M=11,13),JSIZE,DIFFER
300	CONTINUE
	CALL CLOSE(1)
	CALL CLOSE(2)
5	CONTINUE
	RETURN
	END
