C
C SUBROUTINE 'FILMRD'
C ===================
C
C READ NEXT RECORD FROM FILM IMAGE FILE (FLMOPN MUST HAVE BEEN CALLED
C TO OPEN THE FILE AND SET IT TO THE REQUIRED START RECORD)
C
      SUBROUTINE FILMRD(IUN,IDEN,NVALS,MSGERR,ERR)
C
C PARAMETERS
C
C      IUN (I)   FORTRAN UNIT NO. ON WHICH FILE HAS BEEN OPENED
C     IDEN (O)   INTEGER ARRAY TO RETURN THE DENSITY VALUES
C    NVALS (I)   NO. OF VALUES TO BE RETURNED IN IDEN
C   MSGERR (I)   UNIT NO. FOR PRINTING ERROR MESSAGES (0 IF NO
C                MESSAGES REQUIRED)
C      ERR (O)   ERROR FLAG: = .TRUE. ERROR IN READ, = .FALSE. READ OK
C   
C ***GENERAL VERSION***
C
C PARAMETER STATEMENT
C -------------------
C
C MAXLRC = MAXIMUM RECORD LENGTH COPED WITH BY THE ROUTINES
C
      PARAMETER (MAXLRC=9600)
C
C SPECIFICATION STATEMENTS
C ------------------------
C
      LOGICAL ERR
      DIMENSION IDEN(NVALS)
      INTEGER IBUF(MAXLRC/4)
      COMMON /FLMQQQ/KREC,IRECL,NBW,IBUF
C
C CODE
C ----
C
      ERR=.FALSE.
      KREC=KREC+1
      CALL FILMRR(IUN,KREC,IBUF,IRECL,ERR)
      IF (ERR) GO TO 800
      CALL CCPBYI(IDEN,IBUF,NVALS)
      RETURN
C
C ERROR CONDITIONS
C ----------------
C
800   IF(MSGERR.GT.0)WRITE(MSGERR,2001)KREC
      RETURN
C
C FORMAT STATEMENTS
C -----------------
C
2001  FORMAT(/,' **ERROR IN READING FILM IMAGE RECORD ',I5,' **')
      END
