; TFILE
;---------------------------------------------------------------
;! sorts and edits MkIII correlator UNIX-based A-file.
;# Task UV VLBI
;-----------------------------------------------------------------------
;;  Copyright (C) 1997
;;  Associated Universities, Inc. Washington DC, USA.
;;
;;  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., 675 Massachusetts Ave, Cambridge,
;;  MA 02139, USA.
;;
;;  Correspondence concerning AIPS should be addressed as follows:
;;         Internet email: aipsmail@nrao.edu.
;;         Postal address: AIPS Project Office
;;                         National Radio Astronomy Observatory
;;                         520 Edgemont Road
;;                         Charlottesville, VA 22903-2475 USA
;-----------------------------------------------------------------------
TFILE     LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
TFILE     Task which sorts and edits UNIX-based A-file.
INFILE                             Input A-file (version => 4)
OUTFILE                            Output A-file (text)
OPCODE                             'SORT' - will sort the file
                                   'EDIT' - will sort and edit
APARM                              Criteria used to determine
                                   if MkIII scan is acceptable.
                                   Only used if OPCODE='EDIT'
                                   APARM(1) = 1:
                                      Edit on processing time.
                                   APARM(1) = 2:
                                      Edit on quality factor
                                   APARM(1) = 3:
                                      Edit on SNR
                                   APARM(1) = 4:
                                      Edit on # secs in scan
                                   APARM(2): experiment number
                                    to accept, 0 => accept all.
----------------------------------------------------------------
TFILE
Task:  This task will sort and edit the UNIX-based A-file (text)
       that accompanies MkIII A tapes (when they come as
       standard UNIX TAR). It is expected that the user
       will have concatanated all A-files associated with an
       experiment before running this task. The purpose of
       editing is to remove duplicate scans from the A-file,
       the criteria for removing scans are set by the user
       using APARM(1). The resultant file is then used in
       M3TAR to select the scans that the user wishes to read
       from the A tape.
Adverbs:
  INFILE.....Input A-file (UNIX-based, version => 4)
  OUTFILE....Output A-file (ditto)
  OPCODE.....'SORT' - will sort the file
             'EDIT' - will sort and edit
  APARM......Criteria used to determine if MkIII scan is
             acceptable. Only used if OPCODE='EDIT'
             If APARM(1) = 1, duplicate scans will be
             removed based on the processing date encoded in
             the AFILE. The scan with the latest processing
             date will be kept.
             IF APARM(1) = 2, duplicate scans will be removed
             based on the quality factor encoded in the AFILE,
             the scan with the highest quality factor will be
             kept.
             IF APARM(1) = 3, duplicate scans will be removed
             based on the signal-to-noise ratio encoded in the
             AFILE, the scan with the highest quality factor
             will be kept.
             IF APARM(1) = 4, duplicate scans will be removed
             based on the number of seconds of data in the scan,
             the scan with the highest quality factor will be
             kept.
             If APARM(2) = 0, AFILE will accept all experiment
             numbers. If APARM(2) > 0, AFILE will only accept
             those scans which are part of the experiment
             number specified. The experiment number is assigned
             at the correlator.
----------------------------------------------------------------
