[Simh] Converting VMS BACKUP saveset file to SIMH tape file

Edward Berry eaberry1 at pacbell.net
Sun Mar 28 14:24:30 EDT 2010


Rob Jarratt wrote:
> I have some C# code which may do this. If I can find the code would you
> like to give it a go?
>
> Regards
>
> Rob

I would also be interested in getting the code if it resurfaces!
Does it make a disk file to mount on simh, or a saveset to FTP into
the simulated filesystem and read as a disk-based saveset?


I've been dd'ing the savesets from exabyte tapes written by VMS
to linux (which I realize may not be the same thing as FTP'ing a disk-based saveset)
This requires dividing the file into blocks (see simh_magtape.pdf
on trailing edge website). For small savesets I was able to use
Helbig's enblock.c:

http://www.ba-stuttgart.de/~helbig/os/v6/enblock.c
with some description at
http://minnie.tuhs.org/pipermail/tuhs/2003-June/000612.html

but for large files it was flakey - saveset came out a different size
each time I ran it.
Then I found that using fortran to read the saveset image unformatted
with the correct record length and write it out again, has the same
effect of blocking the records.

Then the saveset had to be combined with its header and footer (also dd'd
from the vaxtape), and if it was not the first saveset the header had
to be prepended with the tape label from the first set. I realize
this is quite different from what the original poster is doing,
but in case anyone needs to restore vax tapes to disk images for
simh I'll put the procedure and code below.


=============================================================================
Restoring vax tapes for simh on a linux machine
Tape drive for reading the tapes: exabyte eliant

script for reading tape files to disk (cd to an empty directory before running)
-----------------------------------
ddvaxtape.csh:
#!/bin/csh -ef
#mt -f /dev/nst0 rewind
mt -f /dev/nst0 setblk 0
foreach nmbr (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 \
  23 24 25 26 27 28 29 30)
dd if=/dev/nst0 bs=80    of=hdr${nmbr}.dat
if $nmbr == 1 then
head -c40 hdr${nmbr}.dat |awk '{print $1}'
head -c160 hdr${nmbr}.dat |tail -c80 |awk '{print $1,$2}'
else
head -c40 hdr${nmbr}.dat |awk '{print $1,$2}'
#cat hdr${nmbr}.dat |awk '{print $1,$2}'
endif
#dd if=/dev/nst0 bs=32768 of=saveset${nmbr}.dat
dd if=/dev/nst0 bs=65536 of=saveset${nmbr}.dat
head -c428  saveset${nmbr}.dat |tail -c135
#head -c444  saveset1.dat |tail -c151
echo
#dd if=/dev/nst0    bs=0      of=saveset${nmbr}.dat
dd if=/dev/nst0 bs=80    of=tail${nmbr}.dat
mt -f /dev/nst0 status
#if $status break
end
exit
If the tape has more than 30 savesets, after it finishes
create a subdirectory and run the program again there
without the rewind instruction.

To list the savesets in each file:
grep EOF tail*.dat

tail10.dat:EOF1RAXISD1.         BCD3  00010010000100 91353 91353 001208DECVMSBACKUP 
  EOF2F3276832768                     M             00
tail11.dat:EOF1RAXIS2.BCK       BCD3  00010011000100 92024 92024 001208DECVMSBACKUP 
  EOF2F3276832768                     M             00
tail12.dat:EOF1BCIIA.MRC        BCD3  00010012000100 92025 92025 000311DECVMSBACKUP 
  EOF2F3276832768                     M             00
------------------------------------
This produces 3 files for each saveset: hdr##.dat, saveset##.dat, and tail##.dat
The first header is longer because it starts with the tape label.
The saveset##.dat files can be listed and extracted on the linux
host using the vmsbu utility.

To use with simh they need to be blocked and recombined with tape label, head, and tail.
http://www.ba-stuttgart.de/~helbig/os/v6/enblock.c will block small files
(or maybe files with small reclength), but for the savesets with
reclength 32768 I used a fortran snippet (real hack, the file names are coded in!
Also I think you need to redimension (character*32768 line) to match the
reclen param the tape was written with.):

c****writing in unformatted mode automatically wraps each record in 4-byte integers giving 
record size.
c     record size can be variable
c
	INTEGER*4 IR
	character*32768 line
          OPEN (UNIT=2,FILE='saveset19.dat',STATUS='OLD',recl=32768,
      .   form='unformatted',access='direct')
          OPEN (UNIT=3,FILE='saveset19.tpe',STATUS='unknown',
      .   form='unformatted',access='sequential')
	DO 77 IR = 1,50000
3       READ(2,rec=ir,err=777)  LINE
	write(6,*) ir
  	write(unit=3) (LINE)
77	continue
777 	close (3)
	end

(This works when compiled with g77 fortran. I just tried gfortran and the file
comes out larger by about one byte per record, so I suppose it won't work)


now putting it all together ("enblock" here is Helbig's enblock, and
saveset19.tpe is the output of the fortran blocking):

#get the tapelabel, from first header, blocked, first 88 bytes:
cat hdr1.dat | enblock 80 > temp.dat
dd if=temp.dat  count=88 bs=1 > $syn/simh/VAX/allback.tpe
#append the appropriate header:
cat hdr19.dat |enblock 80 >> $syn/simh/VAX/allback.tpe
#append the saveset:
cat saveset19.tpe              >> $syn/simh/VAX/allback.tpe
#put end-of-file label?:
dd if=/dev/zero bs=1 count=4  >> $syn/simh/VAX/allback.tpe
#append the tail
cat tail19.dat | enblock 80 >> $syn/simh/VAX/allback.tpe
#put extra 4 zero's for end-of-tape
dd if=/dev/zero bs=1 count=4  >> $syn/simh/VAX/allback.tpe

#mount it on simh!
attach tq2 allback.tpe
c
BACKUP/List/rewind  mua2:



More information about the Simh mailing list