!+ Subroutine to write an entry in an archive of type 0.
!
! Method:
!	The data are transferred to intermediate arrays at fixed
!	precision and written to specified records in the file.
!
! Current Owner of Code: J. M. Edwards
!
! History:
!	Version		Date			Comment
!	1.0		12-04-95		First Version under RCS
!						(J. M. Edwards)
!
! Description of Code:
!   FORTRAN 77  with extensions listed in documentation.
!
!- ---------------------------------------------------------------------
      SUBROUTINE WRITE_ARCHIVE_ENTRY_0(IUNIT
     &   , N_TRANS_RECORD, I1_RECORD, N_PER_ARCH_RECORD, N_TRANS
     &   , FREQ_LOW, FREQ_HIGH, TRANS
     &   )
!
!
!
      IMPLICIT NONE
!
!
!     INCLUDE HEADER FILES.
      INCLUDE 'incl/arch_record_size.pcf'
!
!
!
!     DUMMY ARGUMENTS
      INTEGER	!, INTENT(IN)
     &     IUNIT
!             UNIT NUMBER FOR OUTPUT
     &   , N_TRANS_RECORD
!             NUMBER OF TRANSMISSION RECORDS
     &   , I1_RECORD
!             FIRST RECORD OF ENTRY
     &   , N_PER_ARCH_RECORD
!             NUMBER OF SETS OF VALUES PRE REC.
     &   , N_TRANS
!             NUMBER OF TRANSMISSIONS
      REAL*8	!, INTENT(IN)
     &     FREQ_LOW(N_TRANS)
!             LOWER LIMIT OF INTERVAL
     &   , FREQ_HIGH(N_TRANS)
!             UPPER LIMIT OF INTERVAL
     &   , TRANS(N_TRANS)
!             AVERAGED TRANSMITTANCES
!
!     LOCAL VARIABLES
      INTEGER
     &     I
!             LOOP VARIABLE
     &   , J
!             LOOP VARIABLE
     &   , I_REC
!             NUMBER OF RECORD
     &   , N_LAST
!             NUMBER OF TRANSMISSIONS REMAINING TO LAST RECORD
     &   , N_OFFSET
!             OFFSET IN MAIN ARRAY.
!
!     VARIABLES AT FIXED PRECISION FOR THE ARCHIVE.
      REAL*8
     &     ARCH_FREQ_LOW(NP_BYTES_PER_RECORD/24)
     &   , ARCH_FREQ_HIGH(NP_BYTES_PER_RECORD/24)
     &   , ARCH_TRANS(NP_BYTES_PER_RECORD/24)
!
!
!
      DO I=1, N_TRANS_RECORD-1
         DO J=1, N_PER_ARCH_RECORD
            ARCH_FREQ_LOW(J)=FREQ_LOW(J+N_PER_ARCH_RECORD*(I-1))
            ARCH_FREQ_HIGH(J)=FREQ_HIGH(J+N_PER_ARCH_RECORD*(I-1))
            ARCH_TRANS(J)=TRANS(J+N_PER_ARCH_RECORD*(I-1))
         ENDDO
         I_REC=I1_RECORD-1+I
         WRITE(IUNIT, REC=I_REC)
     &      (ARCH_FREQ_LOW(J), ARCH_FREQ_HIGH(J), ARCH_TRANS(J)
     &      , J=1, N_PER_ARCH_RECORD)
      ENDDO
!
!     THE LAST RECORD IS EXCEPTIONAL.
      N_LAST=N_TRANS-N_PER_ARCH_RECORD*(N_TRANS_RECORD-1)
      IF (N_LAST.GT.0) THEN
         N_OFFSET=N_PER_ARCH_RECORD*(N_TRANS_RECORD-1)
         DO J=1, N_LAST
            ARCH_FREQ_LOW(J)=FREQ_LOW(J+N_OFFSET)
            ARCH_FREQ_HIGH(J)=FREQ_HIGH(J+N_OFFSET)
            ARCH_TRANS(J)=TRANS(J+N_OFFSET)
         ENDDO
         I_REC=I1_RECORD+N_TRANS_RECORD-1
         WRITE(IUNIT, REC=I_REC)
     &      (ARCH_FREQ_LOW(J), ARCH_FREQ_HIGH(J), ARCH_TRANS(J)
     &      , J=1, N_LAST)
      ENDIF
!
!
!
      RETURN
      END
