                       RECOVERING CORRUPTED ANSI MAGTAPES


   By Chris Doran, Sira Ltd., South Hill, Chislehurst, Kent, BR7 5EH, England
             Tel: 01 467 2636,   Telex: 896649,   Fax: 01 467 6515

The program described here will retrieve files from a  corrupted  ANSI  magtape.
It  was  written  after our TS03 started erasing the front two feet of the first
tape loaded after switchon.  It took about 2 years to discover that this was due
to  a  broken  reset  line  on  a bus cable -- nothing else in the expansion box
worried about this line being missing, UNTIL we tried to install  an  RX02!   It
can also be used when a tape has been INI'd by mistake, or to read ANSI tapes on
a system without ANSI support.

The user should be familiar with the ANSI tape structure described in Appendix G
of  the  "RSX-11M/M-PLUS  I/O  Operations  Manual".   Each  file is bracketed by
80-byte  header  and  trailer  blocks  containing  the  file  name   and   other
information.   The  program  expects  the  normal sequence of blocks, and copies
files (selectively) so long as it  finds  them.   Whenever  it  meets  something
unexpected, instead of giving up like MOUNT, PIP, or COPY, it displays the block
on the terminal and asks what it should be.  It will handle  both  'D'  and  'F'
formats,  as  given  in  the  HDR2  record,  or specified by the user if that is
missing or invalid.

Answers to most questions are single characters:-

     Y = Yes
     N = No
     Q = Quit program (close current file and exit)
     S = copy file Slowly, displaying and querying each block
     F = copy rest of file Fast (cancels 'S' mode)
     I = Ignore rest of current file (used in slow mode)

'Slow' mode is useful for finding the start of real data on a  highly  corrupted
tape.   When  a file block is found without a header to give it a name, the user
is asked for one.  If an EOF block containing the name appears subsequently,  it
can be renamed.

RT-11 ANSI tapes have 512-byte headers, no HDR2 and EOF2 blocks, and  all  files
are  in  'F'  format.   Answering  'Y'  to  the  "Written  by  RT-11?"  question
accommodates for these differences at the expense  of  some  intelligence.   The
program does not undo RT-11's embedded carriage-control.

Both FORTRAN-77 and FORTRAN-FOUR-PLUS versions of the program are supplied,  but
please   note   that   the   F4P   version   has   not  been  updated  to  match
enhancements/corrections to  the  F77  one.   Neither  version  of  the  program
currently recognises HDR3 type records.

The F77 files are:

     ANSI.FTN                 CLSREN.FTN               GETCHR.FTN
     MTQIO.FTN                OPNFIL.FTN               TYPBLK.FTN
     UCASE.FTN                ANSICOM.FTN              RENAME.MAC
     ANSIBLD.CMD

and the F4P versions are:

     ANSITAPE.F4P             ANSICOM.F4P              RENAME.MAC

I do not have a FORTRAN-IV version, as we do not have that  compiler.   The  F4P
program  could be modified quite easily, however.  The only special F4P features
I remember  using  are  INCLUDEs,  which  must  be  done  with  an  editor,  and
INTEGER*4's used to contain 4-character strings, which could probably be changed
to REAL's.
