Making your own tapes

9track A 9 track magnetic tape, from the Museum of Obsolete Media

In this post we’ll look at how to create your own emulated tapes to transfer data between MTS and your host operating system. For an introduction to tapes on MTS take a look back at this earlier article.

The lbltp program

You will need to install the lbltp program on your host OS. This allows reading from and writing to emulated tape files compatible with Hercules.

The version at Bitsavers contains source and executable for Mac and Windows. On Linux, get the latest version from Mike Alexander’s SVN repo and build locally:

$ svn checkout https://svn.msalexander.com/repo/utilities/lbltp/trunk lbltp
$ cd lbltp
$ mkdir build
$ cd build
$ make -f ../Make/makefile
$ sudo cp lbltp /usr/local/bin

Documentation can be found in the Writeup directory. Type lbltp to start the program, give it commands at the Please enter request prompt and type stop to exit.

Set up a spare tape drive

The starter version of D6.0 comes with a number of tape drives defined and loaded with the distribution tapes. You could use these to mount your own tapes but it is easier to set up a new tape drive.

Make sure MTS and Hercules are shut down then edit the Hercules.cfg file. In the tapes section add a line like this:

0C70 3420 * # User tape drive

This defines a 3420 model tape drive at address 0C70 which corresponds to MTS device T920. The * means no tape is loaded when Hercules starts up.

Creating a new tape from MTS

Let’s create a new tape, mount it for writing and use *FS to store a couple of files which we can then read from the host OS.

First you will need to create a blank tape file. You can use the hetinit program that comes with Hercules to do this. Change directory to Tapes and issue the following command from your host OS:

hetinit -d new.aws NEW

This will create a file new.aws with tape volume name NEW.

Next, issue a mount request for this new tape from MTS:

$mount mts:tape1 9tp *t* vol=NEW ring=in

Note the ring=in parameter as we are going to write to the tape. We are using regular labeled tapes so we don’t need the lbltype=vlo parameter used for distribution tapes.

Switch to the Hercules console and issue a devinit command to initialise the tape drive with the file:

devinit 0c70 Tapes/new.aws

Go now to the MTS operator’s console and respond to the mount request:

OK TAPE1 T920

If all goes well your MTS session will respond that the tape was mounted. You can now run *FS to add files to the tape. Note the par=init parameter as this is a new tape:

$run *fs 0=*t* par=init
# Execution begins   11:24:36 
= save alpha
= File 1 "ALPHA(1)" ... has been saved
= save gamma
= File 2 "GAMMA(1)" ... has been saved
= stop
= Do you want *FS to dismount the tapes it used?
? yes
= "*T*": (MTS.:TAPE1) T920 released.
# Execution terminated   11:24:46  T=0.058 

Reading the tape from your host OS

You can now use lbltp to open the tape file and extract files to your host OS. Below is a sample session showing how to do this:

ITD Tape Utility version 1.3

Please Enter Request
open new.aws
Open input or output tape?
input

Please Enter Request
list
         Listing for IBM labeled *FS tape NEW 
FS file     1  ALPHA                            blks=1 recs=2 bytes=78
FS file     2  GAMMA                            blks=1 recs=13 bytes=366
Logical End of Tape reached.

Please Enter Request
copy file=1-2
Copying FS file 1 ALPHA to alpha.
   1 blocks 2 records 78 bytes             2 records 80 bytes
Copying FS file 2 GAMMA to gamma.
   1 blocks 13 records 366 bytes             13 records 379 bytes

Please Enter Request
stop

Note that lbltp takes care of EBCDIC to ASCII conversion, but line numbers from MTS are not preserved.

Creating a tape from your host OS

Now let’s try to do it the other way, creating a tape with some files from your host OS and transferring these into MTS.

One problem is that lbltp only supports reading *FS formatted tapes, not writing to them. So we will have to write a regular labeled tape and use lower level tape positioning commands on MTS to extract files.

(I think it should be technically possible to extend lbltp to support writing *FS tapes; could be an interesting project.)

The below lbltp session shows how to create a new tape and add two files. Note that you have to give an explicit filename command before adding each file to the tape.

ITD Tape Utility version 1.3

Please Enter Request
initialize send.aws volume=SEND

Please Enter Request
filename delta

Please Enter Request
copy input=delta output
Copying file delta to send.aws file 1 DELTA.
             3 records 37 bytes   1 blocks 3 records 37 bytes 

Please Enter Request
filename epsilon

Please Enter Request
copy input=epsilon output
Copying file epsilon to send.aws file 2 EPSILON.
             4 records 29 bytes   1 blocks 4 records 29 bytes 

Please Enter Request
stop

Reading the tape from MTS

Now we need to mount the tape on MTS. On the Hercules console (note the ro parameter):

devinit 0c70 Tapes/send.aws ro                                                  

From MTS:

$mount mts:tape1 9tp *t* vol=SEND

On the MTS operator’s console:

OK TAPE1 T920

The tape is now mounted on pseudodevice *T*. To get a listing of files, there’s a useful MTS program called *LABELSNIFF we can run, giving the tape pseudodevice as parameter 0:

# run *labelsniff 0=*t*
# Execution begins   10:50:15 


  Tape = *t* User ID REL. 10:50:15 19 Sept 1914

  Tape name=MTS.:TAPE1
  IBM labeled  6250-bpi 9TP Volume=SEND 
  LP=on BLK=on RING=out DTCHK=on RETRY=10

  File                    Block Record  Tapelen  Record 
     # Data set name      count  count   (feet)  format 

     1 DELTA                  1       3    1.10 VBS(32760,32767) 
     2 EPSILON                1       4    1.08 VBS(32760,32767) 
 
  Total tape length = 2.18 feet.
 
  <*><*><*>  End of tape  <*><*><*> 
# Execution terminated   10:50:23  T=0.029 

(For those of us who have never used real tapes it’s interesting to visualise files having a length in feet!)

Now to extract the files. For each file we will need to use a $control command to position the tape and then use the MTS $copy command to read from the tape and write to a file. We will also need to create the files we want to write to. For example:

$control *t* posn=epsilon
$create epsilon
$copy *t* epsilon

You don’t have to copy to a file; if you just wanted to display the file you could do $list *t*.

When finished, you will need to release the tape:

$release *t*
# "*T*": (MTS.:TAPE1) T920 released.

Further information

MTS Volume 19 has extensive information on using tapes. I also found the tutorial guide made by the UM Computer Centre Introduction to Magnetic Tapes - Getting It on Tape useful.

There’s a program on MTS called *UNIXTAR that looks like it can read and write tar format files, so one alternative that I have not tested is to create a tar file on the host OS, add this as the single file on a tape and use *UNIXTAR to extract all the files in one step.

Comments

comments powered by Disqus