; MK3TX
;---------------------------------------------------------------
;! extract text files from a MKIII VLBI archive tape
;# TASK VLBI UTILITY
;-----------------------------------------------------------------------
;;  Copyright (C) 1995
;;  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
;-----------------------------------------------------------------------
;---------------------------------------------------------------
MK3TX     LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
MK3TX     Task which extracts text files from MkIII archives

INTAPE             0.0         9.0 Tape drive number
----------------------------------------------------------------
MK3TX
Task:   This task interactively reads text files from MkIII VLBI
        archive tapes (either "A" tapes or "B" tapes).  It
        prompts for inputs.  See EXPLAIN MK3TX for details.
Adverbs:
  INTAPE.....Tape drive from which to read files.
----------------------------------------------------------------
MK3TX: Extracts text files from a MkIII VLBI archive tape.
DOCUMENTOR: C. Flatters, NRAO/AOC
RELATED TASKS: MK3IN

                        PURPOSE

     Haystack MkIII archives contain a number of text files
associated with the correlation of an experiment as well as the
correlated data for that experiment.  Several of these files contain
information that is useful during data reduction.  A list of file
types is given below.  MK3TX allows text files to be extracted from
the archive tape.  It handles both "A" and "B" tapes.

                        OPERATION

     MK3IN is an interactive program.  It first reads the index from
the archive and then displays a list of text files found on the tape
and asks the user to choose one.  For example

Text files found on tape:

 1 -- #A0000
 2 -- #A7226
 3 -- #EC740
 4 -- #FR740
 5 -- #LT740
 6 -- #PL042
 7 -- #PS000
 8 -- #PS740
 9 -- #SK740

Enter number of file to extract (0 to exit):

At this point the user should enter an integer number
corresponding to the file he wishes to extract.  For example
to extract #EC740 above the user should type '3 <RETURN>'.  If
the number entered is larger than the highest number displayed
or is negative the menu and prompt will be displayed again
until the user gives a valid file number. If the user enters
zero then the task terminates.

     After the user has entered a valid file number MK3IN will
position the tape at the correct file. The file has a header
which should contain the name of the file. If this does not
match the requested file name MK3IN will ask the user whether
he wishes to continue: in most cases the header is merely
corrupt and the user may answer yes. After finding the file
prompt for an output file name.

Enter output file name:

The output filename must be proceeded by a 'logical' name for
the output directory.  Set this up using commands of the form

DEFINE MYVLBI DISK$USER2:[USER.VLBI]       (VMS)
setenv MYVLBI ~/vlbi                       (Unix C shell)
MYVLBI=/mnt/user/vlbi; export MYVLBI       (Unix Bourne shell)
export MYVLBI=~/vlbi                       (Unix Korn shell)

Note that the 'logical' name must be in upper case.  An example
of a valid file name is

MYVLBI:EC740

If the name is entered in mixed case it will be converted to
upper case.

     When a filename has been given MK3TX will display the messages

Skipping  3 files forward to #EC740
#EC740 found

and begin to translate the tape file to the local text file format.
Numbers and names will vary, of course.  If no errors occur then MK3TX
will display the message.

Extracted    25 lines from #EC740

and display the file menu again.  The user may choose to extract
another file as above or to exit by typing '0 <RETURN>'.

                   MKIII TEXT FILES

The following is a list of text files that might be found on a
Haystack MkIII VLBI archive tape.  The following conventions are
used in the file names.

      tttt                         the archive tape number
      nnn or nnnn                  the 3 or 4-digit experiment
                                   number assigned by the
                                   correlator
      iii                          an integer distinct from
                                   either of the above.

File name            Comments
=========            ========

#A0000               An index to the archive tapes from the
                     correlator at which the tape was written.
                     Contains no useful information.

#Atttt               The "A" file for this tape.  The "A" file
                     summarizes the information held on the tape
                     for each scan, including the multi-band and
                     single-band delays found by the Haystack
                     FRNGE program.

#ECnnn               The experiment catalogue.  This lists the
  or                 scans in the experiment and the tapes on
#Ennnn               which they were archived.

#FRnnn               The FRNGE control file. See Walter Alef's
  or                 lecture in "Very Long Baseline
#Fnnnn               Interferometry -- Techniques and
                     Applications"  (Ed. Felli & Spencer,
                     Reidel, 1989) for details.

#LTnnn               A summary of the MkIII field system log
  or                 files.
#Lnnnn

#PLiii               Unknown.  Appears to contain a subset of
                     the "A" file and may be associated with the
                     plotting of FRNGE solutions.

#PS000               Processing summary of experiments
                     correlated at the correlator at which the
                     tape was written.

#PSnnn               Processing summary for this experiment.
  or
#Pnnnn

#SKnnn               Schedule file.  Contains a large amount of
  or                 information, most of which is duplicated in
#Snnnn               the data.  Also contains the exact
                     telescope names used by the correlator and
                     which are required by MK3IN.

[LOG?i               Log file. The letter following LOG is the
                     antenna code and the digit is the last
                     digit of the experiment serial number
                     (?). Log files for your experiment are
                     not guaranteed to be on your archive
                     tapes and any log files found on your
                     tapes are not guarenteed to belong to
                     your experiment.

                   REFERENCES

Alef, W. "Scheduling, Correlating and Postprocessing of VLBI
observations", in "Very Long BaseLine Interferometry --
Techniques and Applications", Ed. M. Felli and R. E. Spencer,
Reidel, Holland, 1989 p97.
