!+ Subroutine to get the limnits of a spectral band.
!
! Method:
!	A string is supplied and searched to find the hyphen
!	dividing the limits. These limits are then read.
!
! 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 SET_LIMIT_BAND(IERR
     &   , STRING, LENGTH
     &   , LIM_1, LIM_2
     &   )
!
!
      IMPLICIT NONE
!
!
!     INCLUDE HEADER FILES.
      INCLUDE 'incl/error.pcf'
      INCLUDE 'incl/def_std_io.icf'
!
!     DUMMY ARGUMENTS.
      INTEGER	!, INTENT(OUT)
     &     IERR
!             ERROR FLAG
      CHARACTER	!, INTENT(IN)
     &     STRING*73
!             STRING TO BE ANALYSED.
      INTEGER	!, INTENT(IN)
     &     LENGTH
!             LENGTH OF STRING TO BE ANALYSED.
      REAL*8	!, INTENT(OUT)
     &     LIM_1
     &   , LIM_2
!             LIMITS OF BAND (CONVERTED IN CALLING ROUTINE)
!
!     LOCAL VARIABLES
      INTEGER
     &     J
!             LOOP VARAIBLES
     &   , IOS
!             I/O ERROR FLAG

!     FIRST FIND THE HYPHEN IN THE STRING.
      J=1
      DO WHILE ( (J.LT.LENGTH).AND.(STRING(J:J).NE.'-') )
         J=J+1
      ENDDO
      IF (J.EQ.LENGTH) THEN
         WRITE(IU_ERR, '(/A)') 'LIMITS OF BAND INCORRECTLY SET.'
         IERR=I_ERR_IO
         RETURN
      ENDIF
!
!     HERE WE PERFORM LIST-DIRECTED I/O FROM AN INTERNAL FILE. THIS IS
!     LEGAL IN FORTRAN90, BUT NOT IN STANDARD FORTRAN77. HOWEVER, MANY
!     FORTRAN77 COMPILERS WILL PERFORM SUCH I/O. SHOULD THE CODE BE
!     USED WITH A COMPILER THAT DOES NOT PERFORM SUCH I/O, THE EASIEST
!     SOLUTION IS TO WRITE THE STRINGS TO SCRATCH FILES WHICH CAN BE
!     READ USING LIST-DIRECTED I/O.
!
      READ(STRING(1:J-1), *, IOSTAT=IOS) LIM_1
      IF (IOS.NE.0) THEN
         IERR=I_ERR_IO
         RETURN
      ENDIF
      READ(STRING(J+1:LENGTH), *, IOSTAT=IOS) LIM_2
      IF (IOS.NE.0) THEN
         IERR=I_ERR_IO
      ENDIF
!
!
      RETURN
      END
