      subroutine rddal(iunit,key,mlabel,ss,hmat,nn)
      implicit real*8 (a-h,o-z)
      character*(*)key
      character*8 mlabel(4),ast
      dimension ss(*),buf(600),ibuf(600),nbas(8),npos(8)
      dimension hmat(*) 
      logical yw
      integer tri
      tri(i,j)=max(i,j)*(max(i,j)-1)/2+min(i,j)
      yw=.false.
      ast='********'
      rewind iunit
      print*,'scanning ',iunit,' for key=',key
      read(iunit)(dummy,i=1,24),nsym,(nbas(i),i=1,nsym)
      if(yw)print*,'nsym',nsym
      if(yw)print*,'nbas',nbas(1:nsym)
 10   read(iunit)mlabel
      if(.not.(mlabel(1).eq.ast.and.mlabel(4).eq.key))goto10
      print*,'nn',nn
      do i=1,nn
         ss(i)=0.d0
         hmat(i)=0.d0
      enddo   
 100  continue
      print*,'avant read'
      read(iunit)buf,ibuf,length
      print*,'apres read'
      do j=1,length
         hmat(ibuf(j))=buf(j)
      enddo   
      if(length.ge.0)goto 100
      npos(1)=0
      DO  I = 2,NSYM
         npos(i)=npos(i-1)+nbas(i-1)
      enddo   
      IPSTRT = 0
      MATBLK = 0
      DO  ISYM = 1,NSYM
         NBASI = NBAS(ISYM)
            IST = MATBLK
            DO  J = 1,NBASI
               ja=npos(isym)+j
               do k=1,j
                  ka=npos(isym)+k
                  ss(tri(ja,ka))=hmat(ist+k)
               enddo
               IST = IST + J
            enddo
            IPSTRT = IPSTRT + NBASI
         MATBLK = MATBLK + NBASI*(NBASI + 1)/2
      enddo
      return
      end


