Tape mounts in MVS 3.8J, automating them

Ok, I’ve been in computers too long. As soon as I got MVS3.8J running in hercules I thought about backups.
Of course I was running it under Linux so had the server backups to fall back to, but I wanted the OS to do backups as well; so I could restore individual OS files rather than the entire system when I had a problem.
So I wrote a few jobs to backup the key files to AWS tape files, and became thoroughly familiar with the devinit command.
But when I wanted to start backing up more I though lets automate this, why should I need to code tape volsers in my JCL (or manuualy manage the tape volsers) and keep typing devinit.

There is probably a solution out there already, but I wanted to do it myself !.
And I did, full tape automation of all internal tapemounts has been achieved (not for external tapemounts, which is anything not in the ‘automated tape’ database; this is to avoid eternal loops trying to mount an aws tape that doesn’t exist if JCL has a typo on a tape volser, or is you put CBT tapes etc in a different directory to your main tapes).

As well as the TAPEMAN program itself, once I had tapemount automation I went mad with writing tools do do backups. Instead of backing up datasets now I just provide my backup jobs with disk pack volsers and they generate the backup JCL for the files based on listvtoc from the packs, whilst also producing a backup report of every file backed up to the tape including the format/lrecl/blksize/position-on-tape etc that I would need to restore a file. And am even working on a CLIST library that will just let a user type ‘restore filename’ and get it restored, although there is still a lot more work to do there as I’ve decided I first need a way to insert the backup listing name into the tape catalog file and the tape volser name into the backup listing file so they can crossref themselves.

Yes, I’m sure there is a tape mount exit out there somewhere that will give me all the info I need, but I havn’t found it yet. When (if) I do I’ll rewrite it yet again to trigger from there. But until then triggering off console mount messages works perfectly.

Bored yet ?. I’m sure you only want to know how I did it not why or what I intend to do in the future.

One important piece of background information is that while I always though it was needed, without knowing how to use the DIAG8 interrupt to issue the devinit commands from inside the MVS3.8J OS it was never going to be possible. Then I found the HERCCMD program written by Grzes Plucinski that did just that, alas in binary form only so I didn’t learn anything but at least it is freely available, works and can do the devinit commands I needed. And since the later releases of hercules allow DIAG8 to be used but can deny any host shell scripts being run theit is no longer a security issue with allowing DIAG8 commands to be used. So with that I could proceed.

The basic premise of my solution had to be that a pool of tapes was managed, that could be in either scratch or in-use state, the in-use tapes needed to have expiry dates of course. As the ‘key’ for every mount request is really the tape volser being asked for I needed a indexed dataset keyed on the volser, I decided on using an indexed VSAM file. Even though I don’t have many AWS tape files in my pool the records need to be randomly updated by key when a volser is requested or a maintanence job is run. Also I knew nothing about using S/370 assembler against VSAM files, so I just had to proceed down that path (it’s got to be challanging to be interesting).

Fortunately Jay Moseley has a MVS3.8J utilities section on his website that includes an assembler library that allows COBOL programs to use VSAM files. I figured that all I needed was to know how each VSAM function worked I could coble together something, so that was my tutorial. If you examine the code in TAPEMAN and it’s utilities you will see a lot and cut/paste has been going on from Jays library, thanks for releasing it to the world Jay, it’s great.
Obviously as I was cut/paste it didn’t hang together properly at the end, which was good as I had to work through it and get a better understanding (although not a perfect one) of what I was doing. Got there in the end and had TAPEMAN to do the automation of the mounts using Gregs HERCCMD to issue the devinit, plus a whole heap of support utilities to manage the tape catalog database itself.

Went off on another (small) learning curve, When I wanted to create my vsam database I didn’t have enough vsam space reserved on any packs, so I created a dedicated vsam disk pack.

My TAPEMAN solution has one other nice feature as well. If a batch job asks for a scratch tape and there are no more scratch tapes left in the pool it will WTOR the operator to ask for a tape volser to be used, so you can create new ones, overwite an existing one etc. The theory being just because my taoe catalog can’t find a scratch tape doesn’t mean a batch job should be killed.

Hows it triggered you ask ?. Origionally via IEECVXIT and there is still example code provided for doing it that way for now. I myself have moved it to my own message automation task.

Anyway, it works for me. If you are a hercules enthusiest running a MVS 3.8J system there is more information and the toolkit itself available if you want to give it a try.

About mark

At work, been working on Tandems for around 30yrs (programming + sysadmin), plus AIX and Solaris sysadmin also thrown in during the last 20yrs; also about 5yrs on MVS (mainly operations and automation but also smp/e work). At home I have been using linux for decades. Programming background is commercially in TAL/COBOL/SCOBOL/C(Tandem); 370 assembler(MVS); C, perl and shell scripting in *nix; and Microsoft Macro Assembler(windows).
This entry was posted in MVS3.8J. Bookmark the permalink.