Discussion:
[hercules-390] Hercules Console commands via command line
matteo_ferrari@yahoo.com [hercules-390]
2018-07-18 20:54:41 UTC
Permalink
Hi all,
do you know if there is a way to send console commands via hercules command line? I would need to create a script where I would like to integrate some z/OS commands
thx a lot for any suggestion or a script example
Matteo
kerravon86@yahoo.com.au [hercules-390]
2018-07-19 01:55:38 UTC
Permalink
Post by ***@yahoo.com [hercules-390]
do you know if there is a way to send console
commands via hercules command line? I would
need to create a script where I would like to
integrate some z/OS commands
thx a lot for any suggestion or a script example
Do you mean something like this:

auto_run.rc:

devinit 402 tapes/mftopc.het
devinit 403 tapes/awstap.aws

/r 00,clpa,cmd=au

That "/" is dependent on this line in the
Hercules config file:

001F 3215-C / noprompt # Line-mode console

BFN. Paul.
matteo_ferrari@yahoo.com [hercules-390]
2018-07-19 05:28:10 UTC
Permalink
Paul, thx for your reply. Currently in my config file I only have defined 4 3270 terminals as:
0700 3270
0701 3270
0702 3270
0703 3270





I understand I will need to add this line to have a console


001F 3215-C / noprompt # Line-mode console



After that, however it is not clear to me how to pass the commands to Hercules via command line.
I understand you created an auto_run.rc file with a mix of hercules commands and z/os console commands, but how do you run auto_run.rc from command line?
My goal is to script something like this in a linux box running hercules:




/-XXXX STOP DB2


then make a copy of the 3390 volume files


then run


/-XXXX START DB2





thx for your patience with me
Matteo
Martin Truebner Martin@pi-sysprog.de [hercules-390]
2018-07-19 07:14:01 UTC
Permalink
Matteo,

if you skin the cat from the other side it would be easier.

From within the guest op-sys you can issue commands to the hosting
linux.

You need on the MVS side some code/mods to the op-sys to issue DIAG 8
(VM invented to issue commands to the "hardware-console" and supported
by Herc)

from there on it is easy- I am not that deep into z/OS but there are
others that can help with that.

Here is my sample that switches on lights connected to a on a
rasberry-pi (the heart of my z114)



Martin
kerravon86@yahoo.com.au [hercules-390]
2018-07-19 08:04:00 UTC
Permalink
Post by ***@yahoo.com [hercules-390]
After that, however it is not clear to me how
to pass the commands to Hercules via command line.
From the Hercules integrated console, you
can just type in:

/c u=herc01

or whatever operator command you want.

The "/" is as per the hercules config.
Post by ***@yahoo.com [hercules-390]
but how do you run auto_run.rc from command line?
Just type in "script auto_run.rc" or you can
set the HERCULES_RC variable to this,
which is what I do.

BFN. Paul.
matteo_ferrari@yahoo.com [hercules-390]
2018-07-19 13:03:11 UTC
Permalink
Paul sorry I expressed myself incorrectly. I would need to run a linux script from linux shell that sends zos commands, the run linux commands and then again runs zos commands.
I would need to run everything from linux shell, not from inside hercules.....
thx for your patience
Matteo
Mike Stramba mikestramba@gmail.com [hercules-390]
2018-07-19 13:44:14 UTC
Permalink
Well, you're going to need Hercules running, to run zos :)

Once hercules is running you can put "sh" or other hercules commands
in the hercules.rc file.

Hercules runs the commands in hercules.rc on start up.

But I'm not sure if ZOS will allow a 3215 as a console.

In that case, you might have to look at Martin's suggestion of the DIAG 8 mod.

I *think* the code is in the Hercules-mvs files section ? ( Or maybe
it's in this group's file section ?)

MIke
Post by ***@yahoo.com [hercules-390]
Paul sorry I expressed myself incorrectly. I would need to run a linux
script from linux shell that sends zos commands, the run linux commands and
then again runs zos commands.
I would need to run everything from linux shell, not from inside hercules.....
thx for your patience
Matteo
'Dave Wade' dave.g4ugm@gmail.com [hercules-390]
2018-07-19 15:03:14 UTC
Permalink
Matteo,

So long as the correct commands are run in the correct order does it matter from which environment they are run?

Dave



From: hercules-***@yahoogroups.com <hercules-***@yahoogroups.com>
Sent: 19 July 2018 14:03
To: hercules-***@yahoogroups.com
Subject: [hercules-390] Re: Hercules Console commands via command line





Paul sorry I expressed myself incorrectly.

I would need to run a linux script from linux shell that sends zos commands, the run linux commands and then again runs zos commands.

I would need to run everything from linux shell, not from inside hercules......

thx for your patience

Matteo
'\'Fish\' (David B. Trout)' david.b.trout@gmail.com [hercules-390]
2018-07-19 18:21:13 UTC
Permalink
Matteo wrote:

[...]
Post by ***@yahoo.com [hercules-390]
I would need to run a linux script from linux shell
that sends zos commands, the run linux commands and
then again runs zos commands.
I would need to run everything from linux shell,
not from inside hercules.....
How does z/OS interface (interact/communicate) with the outside world? And can that interface be automated? Those are the question that need to be asked and answered.

One way that z/OS interacts (interfaces) with the outside world is via its master console. The z/OS operator enters z/OS commands on the master console and z/OS processes them and displays the results.

The z/OS master console is *usually* (typically) a 3270 display terminal, BUT... it doesn't have to be. z/OS is able to communicate to its operator (and the operator is able to communicate with z/OS) via the "Hardware Management Console" (HMC). On Hercules, the HMC is the same panel display that Hercules uses to display its messages to you and which contains a command-line where you can enter Hercules commands. The guest operating system (z/OS) is able to write messages to Hercules's HMC (panel) and Hercules is able to send commands directly to the guest (z/OS).

But you need to first ask the guest (z/OS) to use the HMC as its master console, and not a 3270 display. I'm not sure how to do that (I'm not a z/OS person), but I do know that when z/OS is IPLed, if it cannot find a master console, it will automatically begin sending its messages to the HMC (Hercules panel).

IF/WHEN z/OS is thus using the HMC for all operator communication, you can then send it commands via the Hercules command line, by simply prefixing your Hercules commands with either an exclamation mark (for unsolicited commands) or a period (for solicited replies).

Then all you need to do is figure out a way to communicate with Hercules from the Linux shell. You would enter a "Hercules command" from your Linux shell, and that command would be sent to Hercules, which would then send it to your z/OS guest. The z/OS response would be written to the Hercules panel AS WELL AS being returned back to your Linux shell for display.

So how do you communicate with Hercules via the Linux shell?

Via HTTP!

Hercules supports an HTTP Server interface. Simply configure the HTTP Server via the "HTTP" configuration file statements and Hercules's HTTP Server will be up and running.

Then via a simple Linux shell script, you can send commands to, and receive responses from, Hercules (which, as explained, will simply act as the "middle man" in your communication chain: if the commands you send to Hercules start with '!' or '.', then Hercules will send them to z/OS, and whatever response z/OS writes will be written to Hercules's panel, which should be returned to your Linux script).

I do not know whether doing things this way is the best way (or the easiest), BUT... it is one possible way to accomplish what it is you are trying to do.

Others on the list can help you with the details.

Hope that helps!
--
"Fish" (David B. Trout)
Software Development Laboratories
http://www.softdevlabs.com
mail: ***@softdevlabs.com
kerravon86@yahoo.com.au [hercules-390]
2018-07-20 02:49:43 UTC
Permalink
Post by ***@yahoo.com [hercules-390]
Paul sorry I expressed myself incorrectly. I would
need to run a linux script from linux shell that sends
zos commands, the run linux commands and then
again runs zos commands.
I would need to run everything from linux shell, not
from inside hercules.....
thx for your patience
Some/all versions of MVS allow you to enter
MVS commands via JCL. Or if they don't,
you can run a program that issues an operator
command. You could then have a script that
sends the JCL to the card reader.

BTW, as an aside, I have my MVS/380
system automated such that it IPLs, runs
a job, and then terminates. So I almost
never interact with either the MVS console
or a TSO terminal. I just use micro-emacs
on Windows to construct JCL, and then
micro-emacs again to look at the job
output.

BFN. Paul.

Loading...