*==============================================================================
* subroutine to read 2dF repeats format files.  returns a string called
* REPLINE with the complete catalogue entry for a particular object, plus
* the individual catalogue parameters.  Modified from the 2dfcatread.f code
*
      subroutine repread(iunit,repline,nrep,ier)
*
* written by S.M. Croom, 16/11/01.
*
* 09/06/03: Updated to include IAU name, RA, Dec, and mags.  Now use
*           the main catalogue include file.
*
*###############################################################################
*                                                                              #
*          LICENCE                                                             #
*                                                                              #
*          This program is free software; you can redistribute it and/or       #
*          modify it under the terms of the GNU General Public License         #
*          as published by the Free Software Foundation; either version 2      #
*          of the License, or (at your option) any later version.              #
*                                                                              #
*          This program is distributed in the hope that it will be useful,     #
*          but WITHOUT ANY WARRANTY; without even the implied warranty of      #
*          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the       #
*          GNU General Public License for more details.                        #
*                                                                              #
*          You should have received a copy of the GNU General Public License   #
*          along with this program; if not, write to the Free Software         #
*          Foundation, Inc., 59 Temple Place - Suite 330,                      #
*          Boston, MA  02111-1307, USA.                                        #
*                                                                              #
*###############################################################################
*
* definition of variables:
      implicit none
      integer iunit,nrep,ier
* include file for common block and definition of variables: 
      include '/home/aaossz/scroom/data/2df/code/cat/2QZ/2dfcatformat.h'
*------------------------------------------------------------------------------
* set ier=0, subroutine returns ier=1 if end of file or error found.
      ier=0
* read catalogue entry into string "line":
      read(iunit,1000,err=9999,end=999) repline
 1000 format(a145)
* read catalogue parameters from string "line":
      read(repline,2000,err=9998,end=999) iauname,ra1j,ra2j,ra3j
     &   ,dsigncharj,dec1j,dec2j,dec3j,catname,b,ub,br,z1,zq1,id1,date1
     &   ,fobs1,fibre1,sn1,nrep,comments1
 2000 format(a16,1x,i2,1x,i2,1x,f5.2,1x,a1,i2,1x,i2,1x,f4.1,1x,a10,1x,f6
     &   .3,1x,f7.3,1x,f7.3,1x,f6.4,1x,i2,1x,a10,1x,a8,1x,i4,1x
     &   ,i3,1x,f7.3,1x,i2,a20)
      return
 999  ier=1
      return
 9998 stop 'repeat list line read error'
 9999 stop 'repeat list file read error'
      end
*==============================================================================
