Using Diagnose 8 to issue hercules commands from Turnkey3 MVS3.8J

One of the things any Turnkey3 users eventually asks is how to issue hercules commands from the MVS3.8J guest OS, primarily to mount tapes. Generally asked by those users like me that have automated the environment startup to the point the hercules console is never needed, and in my case while it is accessable if needed it requires me logging onto the remote machine running my setup to access it; a pain.

Jay Moseley has in the FAQ section of his website covering obtaining and installing the binary only HERCCMD program which can be used to issue commands to hercules. I used that for quite a while and it works as documented. One important thing to note is Jays documentation says enabling diag8 for hercules allows host .sh scripts to be run which is only because older versions of hercules allowed that from the hercules console, that is no longer the case, later versions of hercules have a seperate configuration option that locks down host script execution; in case the defaults change you should explicity disable script execution before allowing the guest to use diag8 however.

However I’m always curious as to how things are done so just had to figure out what it was doing, and went to the effort of creating a program to do the same thing; the major benifit to me being that I like having the source code to things I use if possible.

The IBM manual GC20-1807-7 VM370 System Programmers Guide Rel 6.4-81 available on the bitsavers.org site has instructions on how to use the diagnose function operation eight to allow a guest VM to issue commands to the CP (hypervisor) to issue CP commands and obtain the responses to the commands.

In my environment (any TK3 environment) MVS3.8J is the guest and the hercules emulator is the CP the guest is running on.
`
The HERCCMD program performs checks for a security product installed to test for authorisation to the program. While the majority of Turnkey3 users will have no security product installed many will have taken the effort to install RAKF now it is available on CBT tapes at cbttape.org so I have included a RACF RACHECK check for authority to resource FACILITY DIAG8 (a custom facility easily handled by RAKF) to provide that function also. There is a toggle in the code that allows anyone wanting to remove all security checks to do so for Turnkey3 users without RAKF.

The code is not complex; it does however have to be assembled into an APF authourised library with AC=1 as it needs to switch into supervisor mode to issue the diagnose instruction.

If anyone is interested in it the latest stable version is available on github.

Minimal documenation and access to any later version not yet stable enough to pe pushed to github is available on my website, but basically it provides the same functions as HERCCMD, so if you have been using that or have looked at the documentation Jay provided in his FAQ for HERCCMD my program is a drop-in replacement.

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.