	program vuscqc
c Viking corrected vus QC
c **11-Mar-04**
	character nv*4
	byte in(450,25)
	integer*2 in2(225,25),last2
	logical err
	parameter (last2='d35'x,last4='2c3e0d35'x)
	equivalence (in(1,1),in2(1,1))
c
	open(2,file='vuscqc.out')
	do n=101,1049
	 write(nv,'(i4)') n
	 if (nv(1:1).eq.' ') nv(1:1)='0'
	 open(1,file='../vussc/vus.'//nv,access='direct',form='unformatted'
&	 ,recl=11250,status='old',err=59)
	 nr=1
	 err=.false.
10	 read(1,rec=nr,end=49) in
	 do k=1,25
	  if (in2(1,k).ne.'909'x.and.in2(1,k).ne.'ffff'x) then
	   do j=1,103,6
	    if (in(j,k).gt.3) then
	     write(2,'(i4,2i3,i4,1x108z2)') n,nr,k,j,(in(i,k),i=1,108)
	     err=.true.
	     end if
	    end do
	   if (in2(54,k).ne.last2) then
	    lhdr=in2(53,k)
	    lhdr=or(lshift(lhdr,16),in2(54,k))
	    is=0
20	    khdr=xor(lhdr,last4)
	    write(206,'(i4,3i3,2z9)') n,nr,k,is,lhdr,khdr
	    if (khdr.ne.0) then
	     ne=0
	     do i=1,32
	      if (khdr.lt.0) ne=ne+1
	      if (ne.gt.3) go to 25
	      khdr=lshift(khdr,1)
	      end do
	     go to 29
25	     is=is+1
	     if (is.lt.108) then
	      khdr=in(105-is,k)
	      lhdr=or(lshift(khdr,24),rshift(lhdr,8))
	      go to 20
	      end if
	     is=999
	     end if
29	    if (is.gt.0) then
	     write(2,'(i4,2i3,i4)') n,nr,k,is
	     err=.true.
	     end if
	    end if
	   end if
	  end do
39	 nr=nr+1
	 go to 10
49	 close(1)
	 if (.not.err) write(2,'(a)') nv//' has no error.'
59	 end do
	stop
	end
