[comp.os.vms] TAPES Program Part 1 of 6

kka059@MIPL3.JPL.NASA.GOV (08/06/87)

  In response to the tremendous popularity of the TAPES utility that I
  offered a few days ago, here it is in 6 parts.  Thanks go to Michael
  Bednarek for the VMS_SHAR utility.

  If you have any problems with TAPES or with creating it from these
  messages, please contact me at any of the addresses below:

+----------------------------+------------------------------------------+
|    Kurt Andersen           |       Jet Propulsion Laboratory          |
|      MIPL Applications     |       Mail Stop 168-427                  |
|      Programmer            |       4800 Oak Grove Drive               |
|    Office: 169-425         |       Pasadena, Calif.  91109            |
+----------------------------+-------------------------+----------------+
|  NETWORKS:                                           | Eat, drink and |
|              SPAN: Mipl3::KKA059    (5.153)          | be merry...    |
|     ARPA Internet: KKA059@Mipl3.Jpl.Nasa.Gov         |                |
|  Internet Address: [128.149.1.28]                    |                |
|     ARPAnet->SPAN: KKA059%Mipl3@Su-Star.Stanford.Edu | for tomorrow   |
|                or: KKA059%Mipl3.Span@Jpl-Vlsi.Arpa   | the system     |
| Ma Bell  (R.I.P.): (818) 354-1672                    | will prang.    |
+------------------------------------------------------+----------------+


....................... Cut between dotted lines and save ......................
$!..............................................................................
$! VAX/VMS archive file created by VMS_SHAR V-4.03 05-Aug-1987
$! which was written by Michael Bednarek (U3369429@ucsvc.dn.mu.oz.au)
$! To unpack, simply save and execute (@) this file.
$!
$! This archive was created by KKA059  "(Kurt Andersen) @ Mipl3.Jpl.Nasa.Gov"
$!      on Thursday 6-AUG-1987 07:37:33.93
$!
$! ATTENTION: To keep each article below 15872 bytes, this program
$!            has been transmitted in 6 parts.
$! You should concatenate ALL parts to ONE file and execute (@) that file.
$!
$! It contains the following 4 files:
$! TAPES.FOR   TAPES.HED   COMPILE_AND_LINK.COM   TAPES.HLP
$!==============================================================================
$ Set Symbol/Scope=(NoLocal,NoGlobal)
$ Version=F$GetSYI("VERSION") ! See what VMS version we have here:
$ If Version.ges."V4.4" then goto Version_OK
$ Write SYS$Output "Sorry, you are running VMS ",Version, -
                ", but this procedure requires V4.4 or higher."
$ Exit 44
$Version_OK: CR[0,8]=13
$ Pass_or_Failed="failed!,passed."
$ Goto Start
$Convert_File:
$ Read/Time_Out=0/Error=No_Error1/Prompt="creating ''File_is'" SYS$Command ddd
$No_Error1: Define/User_Mode SYS$Output NL:
$ Edit/TPU/NoSection/NoDisplay/Command=SYS$Input/Output='File_is' -
        VMS_SHAR_DUMMY.DUMMY
f:=Get_Info(Command_Line,"File_Name");b:=Create_Buffer("",f);
o:=Get_Info(Command_Line,"Output_File");Set (Output_File,b,o);
Position (Beginning_of(b));Loop x:=Erase_Character(1); Loop ExitIf x<>"V";
Move_Vertical(1);x:=Erase_Character(1);Append_Line;Move_Horizontal
(-Current_Offset);EndLoop;Move_Vertical(1);ExitIf Mark(None)=End_of(b)
EndLoop;Exit;
$ Delete VMS_SHAR_DUMMY.DUMMY;*
$ Checksum 'File_is
$ Success=F$Element(Check_Sum_is.eq.CHECKSUM$CHECKSUM,",",Pass_or_Failed)+CR
$ Read/Time_Out=0/Error=No_Error2/Prompt=" CHECKSUM ''Success'" SYS$Command ddd
$No_Error2: Return
$Start:
$ File_is="TAPES.FOR"
$ Check_Sum_is=833972443
$ Copy SYS$Input VMS_SHAR_DUMMY.DUMMY
Xc  Program TAPES -- foreign tape reading program
X
Xc  distributed July 1987 by the Multimission Image Processing Laboratory
Xc                               Jet Propulsion Laboratory
Xc                               4800 Oak Grove Drive
Xc                               Pasadena, Calif. 91109
X
Xc  This program may be freely distributed and copies as long as
Xc  this notice is retained intact with the program and the associated
Xc  DCL help file is also passed along.  
X
Xc  No representations or guarantees are expressed or implied as to the
Xc  suitability of this program for any particular purpose by MIPL or
Xc  JPL.
X
Xc  Please direct comments/suggestions/problems to:
Xc                MIPL3::VICAR                (Span)
Xc                VICAR @ Mipl3.Jpl.Nasa.Gov  (ARPAnet)
X
Xc**********************************************************************
X
Xc  This program operates in two modes:
X
Xc    In "Scan" mode, it scans a tape and prints out information about its
Xc    contents. 
X
Xc    In "Copy" mode it copies all or part of the tape to a disk or second
Xc    tape. In this mode it can also perform translation between ascii and
Xc    ebcdic, or give a hex dump of the input.
X
Xc  The program starts at the current position of the tape(s), so
Xc  repeated executions can be performed to do combinations of operations
Xc  that cannot be specified by the parameters.
X
Xc Syntax:
X
Xc    $ tapes  tape[/qual]  
X
Xc    (Square brackets [] denote optional elements)
X
Xc    Where:
X
Xc      tape specifies the tape drive on which the input tape has been
Xc             mounted FOREIGN.
X
Xc      qual: qualifiers, which may include any of:
X
Xc        /OUT[=x] - specifies the destination of output other than to terminal.
X
Xc             If "x" is a tape drive (or a logical name pointing to one),
Xc            then the data specified by the other qualifiers are copied
Xc            to that tape. (Must be mounted FOREIGN.)
X
Xc             If "x" is not a tape, then all output goes to disk file "x"
Xc            (.DAT, by default). If /OUT is specified without a filename "x",
Xc            the filename is TDUMP.DAT. This disk file will be of type
Xc            'FORMATTED' unless /FIXED is specified, or unless none of
Xc            the qualifiers /RECLEN, /FIXED, /DUMP, /TOASCI, or /TOEBC are
Xc            specified, in which case the file will be unformatted,
Xc            with segmented record-type.
X
Xc             If /OUT is not specified, all output goes to the terminal. 
X
Xc        /DUMP - this causes the output to be in Hex format, suitable for
Xc           visual inspection.  This is the default (in fact, the only
Xc           possible mode) if the output is to terminal.
X
Xc        /COPY - forces "Copy" mode. (This is the default when any qualifier
Xc           is specified other than /OUT or /REWIND.)
X
Xc        /FILES [= n1[:m1] [,n2[:m2] [,...,n10[:m10]]]] -
Xc            The contents of file n1 (or files n1 thru m1) are output;
Xc           also n2 (or n2 through m2), etc.; up to 10 files or file ranges
Xc           may be specified. If /FILES is specified without any numbers, all
Xc           files are output. (If /FILES and /BLOCKS are omitted, the program
Xc           operates in scan mode, see below.)
Xc             If /BLOCKS is not specified, then all blocks are output.
Xc             If the output is not to the terminal, then all bytes in the 
Xc            blocks are output. If the output is to the terminal, then only 
Xc            the first 80 bytes of each block are output unless /BYTES or 
Xc            /ALL is specified.
X
Xc        /BLOCKS=n[:m] - block n (or blocks n thru m) of the files specified
Xc            are output. 
Xc             If the output is to the terminal, then only the first 80 bytes
Xc            of each block are output unless /BYTES or /ALL is specified.
X
Xc        /BYTES=n - only the first n bytes of each block are copied to each
Xc            output record. /BYTES is ignored if it is specified together
Xc            together with /RECLEN or /REBLOCK with tape output.
X
Xc        /ALL - all bytes of the blocks specified are output. This is the
Xc            default except when the output is to the terminal, in which
Xc            case only the first 80 bytes are output by default.
X
Xc        /IGNORE - read errors on the input tape are ignored and whatever
Xc            was read is written to the output unit (if any). This is the
Xc            default for SCAN mode.
X
Xc       /SKIP - like /IGNORE, but a block on which a read error is reported
Xc            is not copied to the output unit (if any).
X
Xc       /AFTER[=n] - write output data after file n on an output tape. (This
Xc            is only valid if an output tape was specified). If n is omitted,
Xc            data will be written after the last file. The default (if /AFTER
Xc            is omitted) is to write data beginning at the current tape
Xc            position. 
X
Xc       /TOASC - perform EBCDIC-to-ASCII character translation on the copied
Xc            data.
X
Xc       /029 - EBCDIC characters were from 029 keypunch
X
Xc       /TOEBC - perform ASCII-to-EBCDC character translation on the copied
Xc            data.
X
Xc       /REWIND - rewind the input tape before any other processing.
X
Xc       /FIXED - output disk file will have fixed-length records. The
Xc            record length used will be that of the first block read
Xc            from the input tape file, unless /RECLEN is specified.
X
Xc       /RECLEN - output record length. For disk output, this specifies
Xc            that the output file will have records of this length.
Xc            If /TOASC or /TOEBC were specified, a record length of 80
Xc            is default.
Xc            If specified for tape output, each input record will be
Xc            truncated or padded (with zeroes) to this length before
Xc            being written to the output tape. This is intended as a
Xc            tool for faulty tapes; for normal re-blocking of tapes, use
Xc            the /REBLOCK qualifier.
X
Xc       /REBLOCK=n - reblock the output by factor n. This is only valid
Xc            for tape output (it is ignored otherwise).
Xc            The output blocksize will be n*(input blocksize).
Xc            If n*(input blocksize) > 65535, then the largest value of
Xc            n below this limit is used.
Xc            Note that if the number of blocks on the input tape is not
Xc            an integer multiple of n, then the last block of the output
Xc            tape will contain fewer than n input blocks.
Xc            /REBLOCK may not be specified with /BYTES or /RECL. If either
Xc            of these is specified as well, it is ignored.
X
Xc       /EOT - if specified, allows the program to read data past the end
Xc            of tape mark. This should be used with caution, as it may
Xc            cause the tape to run off the reel.  (It applies to the input
Xc            tape only.)
X
Xc       /SPLIT - if specified, then an input file that is being copied to
Xc            an output tape will be split into 2 output files if an end-of-
Xc            tape on the output unit is encountered during the copy: the
Xc            portion that has already been copied will be terminated with
Xc            a double end-of-file mark, and the remainder will be copied
Xc            to the next output tape.  The default in this case is to back
Xc            up to the last file, write a double end-of-file after it, and
Xc            then copy the entire next file to the next output tape.
X
Xc  "SCAN" mode:
Xc  In this mode, only bytes-per-block and blocks-per-file are listed for
Xc  all files on the input tape.  In this mode, only the qualifiers /OUT and
Xc  /REWIND are permitted.  If any other qualifier is specified, then "Copy"
Xc  mode is invoked automatically.
X
$ Goto Part2