; TASRT
;---------------------------------------------------------------
;! Task to sort extension tables.
;# TASK TABLE
;-----------------------------------------------------------------------
;;  Copyright (C) 1995, 2009
;;  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
;-----------------------------------------------------------------------
TASRT     LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
TASRT:  Task to sort extension tables.
INNAME                             Main input file (name).
INCLASS                            Main input file (class).
INSEQ             0.0    9999.0    Main input file (seq. #).
                                      0 => high
INDISK                             Disk unit #.       0 => any
INEXT                              Table type (e.g. 'CC')
INVERS                             Input table file version no.
OUTVERS                            Output table file version.
CPARM                              Keys & weights.
                                   1,2=> col. & wt pri. key 1.
                                   3,4=> col. & wt sec. key 1.
                                   5,6=> col. & wt pri. key 2.
                                   7,8=> col. & wt sec. key 2.
BADDISK                            Disks to avoid for scratch
----------------------------------------------------------------
TASRT
Type:  Task
Use:   TASRT sorts the contents of a given AIPS extension table
       producing a new table.  A two key sort is supported and
       each key may be a linear combination of one or two
       columns.  Sorts may be done on character, logical, or
       bit columns, but only one column may be used for each
       sort key in that case.
Adverbs:
  INNAME......Main file name (name).       Standard defaults.
  INCLASS.....Main file name (class).      Standard defaults.
  INSEQ.......Main file name (seq. #).     0 => highest.
  INDISK......Disk drive # of image.       0 => any.
  INEXT.......Extension file type          ' ' => 'TA'
  INVERS......Input extension file version #     0 => highest.
  OUTVERS.....Input extension file version #     0 => highest.
  CPARM.......Table columns and factors for sorting.
              The columns and factors are specified in CPARM,
              the first  (most slowly varying key) is:
                 KEY_VALUE1 = COL_VALUE(CPARM(1)) * CPARM(2) +
                              COL_VALUE(CPARM(3)) * CPARM(4)
              The  faster changing key value is:
                 KEY_VALUE2 = COL_VALUE(CPARM(5)) * CPARM(6) +
                              COL_VALUE(CPARM(7)) * CPARM(8)
              In the case of bit or character strings only one
              column is used to  generate the key values.  In
              this case, CPARM(2) is the first character and
              CPARM(4) is the number of characters to use for
              the first key; CPARM(6) is the first character
              and CPARM(8) is the number of characters to use
              for the second key.
                 Sorting is normally in ascending order of the
              keys, for decending order use a negative factor
              for the relevant key.  Factors of 0 => 1.0.  To
              sort using the ABSOLUTE value of the column, set
              the column number to negative.
                 For a single key sort use CPARM(5)=0.  To use
              a single column as the sort key set CPARM(3)=0
              and/or CPARM(7)=0 as appropriate.
                 Example: sort by col. 1 (slowest varying) and
              col. 6 (fastest) in decending order:
              CPARM=1,1,0,0,6,-1
              To sort by ascending absolute value col. 2 and,
              secondarily, by descending value of col. 1:
              CPARM = -2, 1.0, 0, 0, 1, -1., 0, 0
  BADDISK.....Disk drive numbers to avoid for scratch files.
----------------------------------------------------------------
