!+ Subroutine to write the header for an archive of type 1.
!
! 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_HEADER_1(IERR, IUNIT
     &   , N_ENTRY
     &   , DATE, DATA_BASE, LBL_CODE
     &   , LINE_SHAPE, CUTOFF, CONTINUUM, LINE_COUPLE
     &   , I_GAS, P, T, AMOUNT, PARTIAL_P
     &   , FREQ_ENTRY_LOW, FREQ_ENTRY_HIGH
     &   , N_TRANS_RECORD, I1_RECORD, N_TRANS, D_FREQ
     &   )
!
!
      IMPLICIT NONE
!
!
!     INCLUDE HEADER FILES.
      INCLUDE 'incl/dimensions_arch.ucf'
!
!     DUMMY ARGUMENTS.
      INTEGER	!, INTENT(OUT)
     &     IERR
!             ERROR FLAG
      INTEGER	!, INTENT(IN)
     &     IUNIT
!             UNIT NUMBER FOR OUTPUT
     &   , N_ENTRY
!             NUMBER OF ENTRIES IN THE ARCHIVE
     &   , I_GAS(NPD_ARCH_ENTRY)
!             TYPES OF GASES
     &   , N_TRANS_RECORD(NPD_ARCH_ENTRY)
!             NUMBER OF RECORDS IN ENTRY
     &   , I1_RECORD(NPD_ARCH_ENTRY)
!             POINTER TO FIRST RECORD OF ENTRY
     &   , N_TRANS(NPD_ARCH_ENTRY)
!             NUMBER OF TRANSMISSIONS IN ENTRY
     &   , DATA_BASE(NPD_ARCH_ENTRY)
!             DATA BASE USED FOR LINE DATA
     &   , LBL_CODE(NPD_ARCH_ENTRY)
!             LINE-BY-LINE CODE USED
     &   , LINE_SHAPE(NPD_ARCH_ENTRY)
!             LINE-SHAPE EMPLOYED
      CHARACTER	!, INTENT(IN)
     &     DATE(NPD_ARCH_ENTRY)*9
!             INITIAL DATE OF ENTRY
      LOGICAL	!, INTENT(IN)
     &     LINE_COUPLE(NPD_ARCH_ENTRY)
!             LINE COUPLING STRING
     &   , CONTINUUM(NPD_ARCH_ENTRY)
!             CONTINUUM TREATMENT
      REAL*8	!, INTENT(IN)
     &     CUTOFF(NPD_ARCH_ENTRY)
!             CUTOFFS OF LBL DATA
     &   , P(NPD_ARCH_ENTRY)
!             PRESSURE
     &   , T(NPD_ARCH_ENTRY)
!             TEMPERATURE
     &   , AMOUNT(NPD_ARCH_ENTRY)
!             AMOUNT
     &   , PARTIAL_P(NPD_ARCH_ENTRY)
!             PARTIAL PRESSURE
     &   , FREQ_ENTRY_LOW(NPD_ARCH_ENTRY)
!             LOW FREQUENCY LIMIT OF ENTRY
     &   , FREQ_ENTRY_HIGH(NPD_ARCH_ENTRY)
!             HIGH FREQUENCY LIMIT OF ENTRY
     &   , D_FREQ(NPD_ARCH_ENTRY)
!             INTERVAL OF FREQUENCY COVERED BY TRANSMISSIONS

!
!     LOCAL VARIABLES
      INTEGER
     &     I
!             LOOP VARIABLE
!
!     VARIABLES AT FIXED PRECISION FOR THE ARCHIVE
      REAL*4
     &     ARCH_CUTOFF
     &   , ARCH_FREQ_ENTRY_LOW
     &   , ARCH_FREQ_ENTRY_HIGH
     &   , ARCH_P
     &   , ARCH_T
     &   , ARCH_AMOUNT
     &   , ARCH_PARTIAL_P
     &   , ARCH_D_FREQ
!
!
!
!     THE HEADING RECORDS ARE WRITTEN AT THE BEGINNING OF THE FILE:
!     THE INFORMATION HERE SHOULD ALLOW THE FILE TO BE
!     SEARCHED EFFICIENTLY.
      DO I=1, N_ENTRY
!
!        CONVERT TO THE PRECISION OF THE ARCHIVE.
         ARCH_CUTOFF=CUTOFF(I)
         ARCH_FREQ_ENTRY_LOW=FREQ_ENTRY_LOW(I)
         ARCH_FREQ_ENTRY_HIGH=FREQ_ENTRY_HIGH(I)
         ARCH_P=P(I)
         ARCH_T=T(I)
         ARCH_AMOUNT=AMOUNT(I)
         ARCH_PARTIAL_P=PARTIAL_P(I)
         ARCH_D_FREQ=D_FREQ(I)
!
         WRITE(IUNIT, REC=I+1)
     &      I, DATE(I), DATA_BASE(I), LBL_CODE(I)
     &      , LINE_SHAPE(I), ARCH_CUTOFF, CONTINUUM(I), LINE_COUPLE(I)
     &      , ARCH_FREQ_ENTRY_LOW, ARCH_FREQ_ENTRY_HIGH, I_GAS(I)
     &      , ARCH_P, ARCH_T, ARCH_AMOUNT, ARCH_PARTIAL_P
     &      , N_TRANS_RECORD(I), I1_RECORD(I)
     &      , N_TRANS(I), ARCH_D_FREQ
!
      ENDDO
!
!
!
      RETURN
      END
