        SUBROUTINE YPDEXP(IDIN, FNAME, ETIME, ISTAT)
C
C Module Name: YPDEXP
C
C Keyphrase:
C ----------
C Caculate single frame exposure time
C
C Description:
C ------------
C
C FORTRAN Name: YPDEXP.FOR
C
C Modules Called:
C ---------------
C SDAS:
C OTHERS:
C
C History:
C --------
C Version       Date      Author        Description
C    1          Aug 90    S. Hulbert    Designed and coded
C------------------------------------------------------------------------
C
C     UMSPUT DESTINATIONS -- CB, DAO, 4-SEP-87
C
      INTEGER STDOUT
      PARAMETER (STDOUT = 1)
      INTEGER STDERR
      PARAMETER (STDERR = 2)
C
C       DATA DECLARATION
C
	INTEGER IDIN, OVERSCN, INTS, NPAT, NREAD, ISTAT, ISTATS(5) 
	INTEGER VS(7), VE(7), STEP(7)
	INTEGER CLEARS, IREAD, NREPS
	REAL ETIME
	INTEGER LIVETM, FRAME
	INTEGER I

        CHARACTER*130 FNAME
        CHARACTER * 80 CONTXT
        CHARACTER*8 PNAME(5)
        DATA PNAME/'OVERSCAN','INTS','NPAT','NREAD','LIVETIME'/
C
        CALL UHDGSI(IDIN,PNAME(1),OVERSCN,ISTATS(1))
        CALL UHDGSI(IDIN,PNAME(2),INTS,ISTATS(2))
        CALL UHDGSI(IDIN,PNAME(3),NPAT,ISTATS(3))
        CALL UHDGSI(IDIN,PNAME(4),NREAD,ISTATS(4))
        CALL UHDGSI(IDIN,PNAME(5),LIVETM,ISTATS(5))
	DO 101 I = 1, 5
            IF (ISTATS(I) .NE. 0) THEN 
                CONTXT='Error reading keyword '//PNAME(I)//
     $			' from d0h file'
                GO TO 999
            ENDIF
  101   CONTINUE
        IF(OVERSCN.LT.1)THEN
                CONTXT='ERROR: invalid OVERSCAN in .d0h header'
                GO TO 999
        ENDIF
        IF(INTS.LT.1)THEN
                CONTXT='ERROR: invalid INTS in .d0h header'
                GO TO 999
        ENDIF
        IF(NPAT.LT.1)THEN
                CONTXT='ERROR: invalid NPAT in .d0h header'
                GO TO 999
        ENDIF
        IF(NREAD.LT.1)THEN
                CONTXT='ERROR: invalid NREAD in .d0h header'
                GO TO 999
        ENDIF
        IF(LIVETM.LE.0)THEN
                CONTXT='ERROR: invalid LIVETIME in .d0h header'
                GO TO 999
        ENDIF
C
	CALL UUIMFO (IDIN, FNAME, FRAME, VS, VE, STEP, ISTAT)
        IF (ISTAT .NE. 0) THEN 
            CONTXT='Error determining frame number for '//FNAME
            GO TO 999
        ENDIF
        CLEARS = (FRAME-1)/NREAD
        IREAD = FRAME - CLEARS*NREAD
        NREPS = IREAD * OVERSCN * NPAT * INTS
        ETIME = (LIVETM*7.8125E-6)*NREPS
        GO TO 1000
999     CALL UMSPUT(CONTXT,STDOUT+STDERR,0,ISTAT)
        ISTAT=1
1000    RETURN
        END
