Joined: 01 Mar 2006 Posts: 290 Location: Basel, Switzerland
I have a job, which starts a process in OMVS (i.e. USS for z/OS) using NOHUP. The problem is, that it should be not started as a child process!
My job is running, no doubt, but this mistery, I want to have solved.
- via BPXBATCH, I start a script, which should start the NOHUP as a
parallel process. The starting job (my job) keeps hanging on that NOHUP,
which should not be. The starting job should end and the parallel process
should keep running.
could it be, that there is a conflict with the stdin,stdout and stderr respectively? how could I solve this? how can I start any parallel process,
which are very independent from the starting job/process (i.e. have therefore no dependencies!)
can someone help me further,
maybe someone who has experience with the OpenMVS environment
on z/OS.
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
What is your _BPX_SHAREAS environment parameter set to? What is your _BPX_BATCH_SPAWN environment variable set to? These environment variables control whether a separate address space is used for the child process. Use the IBM web site to pull up the Unix System Services manuals and check out BPXBATCH and BPXBATSL in the User's Guide and Command Reference manuals, if you haven't already done so.
And a terminology note:
Quote:
The problem is, that it should be not started as a child process!
conflicts with
Quote:
The starting job should end and the parallel process should keep running.
Furthermore, if you're starting a process in USS, you are starting a child process by definition -- you do not have a choice about it; you may specify to run the child process in the same or a different address space of z/OS, but it is going to be a child process.
Joined: 01 Mar 2006 Posts: 290 Location: Basel, Switzerland
Hy Robert,
thanks a lot, this is exactly what I am probably looking for...
sorry about my terminology problems, I am just a freaky hosty...
the _BPX_SHAREAS is set to NO
the _BPX_BATCH_SPAWN is not set (empty)
if you note about BPXBATCH and BPXBATSL,
what is the effect in combination with the variables above?
anyway: my purpose is to start a process in a different
address space by a job, thus the job terminates normally
after having started that process., and the process must keep
running. I am using "NOHUP command", not SPAWN...
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
From the Unix System Services User's Guide (section 11.2.5.2 in V1R8 version of the manual):
Quote:
| For long-running commands, however, where you want to use BPXBATCH to
| start a shell command in the background and not wait for completion, you
| must specify the parameter string like this:
| SH nohup command args & sleep 1
SH starts a "login shell" to parse and run the command. The login shell parses the "&," signifying that the command is to run asynchronously (in the background), and forks a child process to run the nohup command. In the child process, the nohup shell command (which takes another command as an argument) prevents the process from being terminated when the login shell returns to BPXBATCH.
Joined: 01 Mar 2006 Posts: 290 Location: Basel, Switzerland
Hy Robert,
sorry I did not inform you again, about your pieces of advice...
what you found in the manual is absolute correct,
but I found out, that the background process is running
without any problem, but the starting skript keeps hanging...
why?
as I thought the problem occurs with the file descriptors...
if you start any child process, the file descriptors for stdin,
stdout, stderr get inherited, therefore: the starting skript gets
no control over those files, unless the child process is finished.
after I defined new file descriptors for the child process the
starting skripts ends as desired... and the child process
will become the new father and keeps running...
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
Section 11.2.5 of the User's Guide says
Quote:
UNIT= and VOL=SER= parameters are not propagated to the process that is being executed by BPXBATCH unless the process is run locally by BPXBATCH via the setting of the _BPX_SHAREAS and _BPX_BATCH_SPAWN environment variables: _BPX_SHAREAS=YES and _BPX_BATCH_SPAWN=YES.
Try setting these environment variables -- although there may be other side effects.