C--------------------------------------------------------------------------
        subroutine ftgknd(iunit,keywrd,nstart,nmax,
     &                    dval,nfound,status)

C       read an array of real*8 values from  header records
C
C       iunit   i  fortran input unit number
C       keywrd  c  keyword name
C       nstart  i  starting sequence number (usually 1)
C       nmax    i  number of keywords to read
C       OUTPUT PARAMETERS:
C       dval    d  array of output keyword values
C       nfound  i  number of keywords found
C       status  i  output error status (0 = ok)
C
C       written by Wm Pence, HEASARC/GSFC, June 1991

        character*(*) keywrd
        integer iunit,nstart,nmax,nfound,status,i,j
        double precision dval(*)
        character keynam*8
        character*80 comm

        nfound=0
        j=nstart
C       search for each possible keyword:
        do 10 i=1,nmax
C               construct keyword name
                call ftkeyn(keywrd,j,keynam,status)
                if (status .gt. 0)go to 900

C               search for keyword value
                call ftgkyd(iunit,keynam,dval(i),comm,status)

                if (status .le. 0)then
                        nfound=i
                else if (status .eq. 202)then
C                       ignore 'keyword not found' error
                        status =0
                end if
                j=j+1
10      continue

900     continue
        end
