C
C SUBROUTINE 'IMPLRD'
C ===================
C
C READ NEXT RECORD FROM IMAGE PLATE FILE (IMPOPN MUST HAVE BEEN CALLED
C TO OPEN THE FILE AND SET IT TO THE REQUIRED START RECORD)
C
      SUBROUTINE IMPLRD(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, SWAP
      DIMENSION IDEN(NVALS)
      INTEGER IBUF(MAXLRC/4)
      COMMON /IMPQQQ/KREC,IRECL,NBW,IBUF,SWAP
      SAVE /IMPQQQ/
C
C CODE
C ----
C
      ERR=.FALSE.
      KREC=KREC+1
      CALL IMPLRR(IUN,KREC,IBUF,IRECL,ERR)
      IF (ERR) GO TO 800
      CALL CCPI2I(IDEN,IBUF,NVALS,.FALSE.,SWAP)
      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 IMAGE PLATE FILE RECORD ',I5,' **')
      END
