; BAKLD
;---------------------------------------------------------------
;! reads all files of a catalog entry from BAKTP tape
;# Task Catalog Tape
;-----------------------------------------------------------------------
;;  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
;-----------------------------------------------------------------------
;---------------------------------------------------------------
BAKLD     LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
BAKLD:  Task to read image or uv data files written by BAKTP
INTAPE            0.0       9.0    Input tape drive # (0 => 1)
OUTNAME                            Image name (name)
OUTCLASS                           Image name (class)
OUTSEQ           -1.0    9999.0    Image name (seq. #)
                                      0 => highest unique number
                                     -1 => BAKTP tape value
OUTDISK           0.0       9.0    Disk drive # (0 => any)
NFILES         -999.0     999.0    # of files to skip on tape
NCOUNT            0.0     999.0    Number of files to PRNT/LOAD.
OPCODE                             'LOAD','PRNT',or ' '
----------------------------------------------------------------
BAKLD
Type: Task
Use:  BAKLD loads files from a BAKTP tape to disk.  Note that
        the BAKTP tape must have been written by an AIPS
        executing on the same architecture as the current AIPS.
        In particular, a Unix AIPS cannot read a tape written
        by BAKTP under VMS, and vice versa. BAKLD restores all
        extensions associated with a file. Each file on a BAKTP
        tape is separate, and after a read operation BAKLD
        leaves the tape positioned after the file separator
        (whose exact nature is host-dependent). No attempt
        should be made to examine or depend on the physical
        format of tapes produced by BAKTP; instead, this task,
        BAKLD, should be used for all manipulations and
        examinations. The option OPCODE='PRNT' will produce
        a summary of the files on a BAKTP tape, which will
        facilitate the use of NCOUNT and NFILES for selective
        reloading of files.
Adverbs:
  INTAPE......The input tape drive #.  0 => 1.
  OUTNAME.....The output image name (name).  Standard behavior
              with default = the original map file name.
              See HELP OUTNAME concerning wildcarding.
  OUTCLASS....The output image name (class).  Standard behavior
              with default = the original map class.
              See HELP OUTCLASS concerning wildcarding.
  OUTSEQ......The output image name (seq #).  0 => Find the
              lowest number which produces a unique mapname.
              -1 => use the original sequence number.
  OUTDISK.....The disk drive #.  0 => use BAKLD default drive.
  NFILES......The number of files to skip over before
              beginning the 'PRNT' or 'LOAD' processing.
  NCOUNT......The number of consecutive files to load from tape.
  OPCODE......Desired mode of operation of BAKLD:
              'LOAD' or ' ' => load file(s) to disk
              'PRNT' => produce directory listing of tape.
----------------------------------------------------------------
BAKLD:  Task to read files from a BAKTP host-dependent tape
Documentor: D.Wells, NRAO-CV, September 1986.
Related Programs: BAKTP

                        PURPOSE

     BAKLD is the task used to read files from tape to disk in
the format used by BAKTP for the local host.

                          COMMENTS

OUTNAME, OUTCLASS, OUTSEQ, OUTDISK
     If OUTNAME is unspecified, the following will be taken:
          Original outname used when writing image
     If OUTCLASS is unspecified, the following will be taken:
          Original outclass used when writing image
     If OUTSEQ = 0
          Lowest available sequence number for the specified
             OUTNAME and OUTCLASS and OUTDISK
     If OUTSEQ = -1
          Original outseq used when writing image
          Lowest available sequence number for the specified
             OUTNAME and OUTCLASS and OUTDISK.
     If OUTDISK = 0
          BAKLD will make a default choice, probably 1.
NCOUNT
    Number of consecutive files to load.  If NCOUNT is zero then
    one file will be loaded.

================================================================
Notes for BAKLD:                  (DCW, 21Nov86)

1. First----GO READ THE EXPLANATION OF BAKTP!

2. Use the REWIND verb with BAKTP tapes; in general, do not use
verb AVF, as the number and position of tapemarks are not
reliably or permanently associated with the savesets for all
implementations of BAKTP. Instead, use the NFILES adverb of
BAKLD to skip over savesets.

3. It is entirely proper to set NCOUNT=big-number (like 999) to
cause BAKLD to process an entire tape. BAKLD will halt at the
End-of-Information.

4. Alan Bridle says: the name BAKLD "...sort of evokes the
image of getting in there with a backhoe and dumping stuff onto
the disk..."

================================================================
'Features', Weaknesses, Bugs, etc.:

0.5: Present beta-test version of BAKLD prints 'RENAME'
messages as a check of the load operation. These will be
removed later.

2. The present BAKLD does not check for the case of the data
version of the tape files being different from the data version
of the host AIPS. It should check, and should automatically
execute a format-upgrade procedure.

3. The discussion about Unix-version speed which is given in
the Explain file for BAKTP applies to BAKLD also.

4. when NFILES>0 and NCOUNT>0 and BAKLD hits the EOI, the test
is done twice, and two messages are printed. This is harmless,
and will be fixed eventually.

5. Present BAKLD does not check for the case of a 'tar' BAKTP
tape written by a different architecture/OS combination.
