Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Starting parallel process via BPXBATCH [USS for z(OS)]

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
martin9

Active User


Joined: 01 Mar 2006
Posts: 290
Location: Basel, Switzerland

PostPosted: Fri Mar 13, 2009 2:59 pm    Post subject: Starting parallel process via BPXBATCH [USS for z(OS)]
Reply with quote

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.

kind regards,
martin9
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8165
Location: East Dubuque, Illinois, USA

PostPosted: Fri Mar 13, 2009 5:13 pm    Post subject:
Reply with quote

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.
Back to top
View user's profile Send private message
martin9

Active User


Joined: 01 Mar 2006
Posts: 290
Location: Basel, Switzerland

PostPosted: Fri Mar 13, 2009 8:18 pm    Post subject:
Reply with quote

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...

I only need the simpliest way doing this...

regards,
martin9
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8165
Location: East Dubuque, Illinois, USA

PostPosted: Fri Mar 13, 2009 8:39 pm    Post subject:
Reply with quote

What does the BPXBATCH command look like? Use BBCODE to paste it as it exists in the JCL stream.

The BPX parameters are set the way they need to be set.
Back to top
View user's profile Send private message
martin9

Active User


Joined: 01 Mar 2006
Posts: 290
Location: Basel, Switzerland

PostPosted: Fri Mar 13, 2009 8:54 pm    Post subject:
Reply with quote

Hy Robert,

the BPXBATCH-JCL is:

Code:
//CZTIPN01 JOB ('IP','OMS'),'CONTROL',                             
//             CLASS=T,                                           
//             MSGCLASS=H,                                         
//             TIME=NOLIMIT                                       
//*            USER=STCPAPY                                       
//*                                                               
//KRNL     EXEC PGM=BPXBATCH,REGION=0M,                           
// PARM='SH cd /anypath/ ; skript.sh'       
//SYSOUT   DD   SYSOUT=*                                           
//STDOUT   DD   SYSOUT=*                                           
//STDERR   DD   SYSOUT=*                                           
//* 


where skrip.sh is:

Code:
#!/bin/sh                                                           
#                                                                   
#*** Start OMS Kernel ***                                           
#                                                                   
# Set umask (enable group to access)                                 
umask 002                                                           
#                                                                   
export _BPX_SHAREAS=NO                                               
#                                                                   
export _CEE_RUNOPTS="termthdact(uadump)"                             
#                                                                   
export ISIS_OMS_DOMAIN=ISIS-PO-LIC                                   
export ISIS_OMS_PORT=9091                                           
export ISIS_KEY_MODE=onlyoms                                         
export LIBPATH=/HPV/isis/isiscomm/mu/lib                             
export ISIS_COMMON=/HPV/isis/isiscomm                               
export TMP=/HPV/isis/tmp                                             
export TEMP=/HPV/isis/tmp                                           
export TMPDIR=/HPV/isis/tmp                                         
# Read machine name and start kernel                                 
machine=`uname -n`                                   
nohup ./pocmuknl /ObjectSpace=DB:/HPV/isis/objects ........

I want the job to finish after NOHUP has started that program,
and the program keeps alive as an independent process.

regards,
martin9

(Edited by A.Margulies to use BBcode)
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8165
Location: East Dubuque, Illinois, USA

PostPosted: Fri Mar 13, 2009 10:19 pm    Post subject:
Reply with quote

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.
You might want to try
Code:
SH (cd /anypath/ ; skript.sh) & sleep 1
although I haven't tested it
Back to top
View user's profile Send private message
martin9

Active User


Joined: 01 Mar 2006
Posts: 290
Location: Basel, Switzerland

PostPosted: Mon Apr 06, 2009 7:51 pm    Post subject:
Reply with quote

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...

thanks for your support and tips,

martin9
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8165
Location: East Dubuque, Illinois, USA

PostPosted: Mon Apr 06, 2009 8:10 pm    Post subject:
Reply with quote

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.

Glad to hear you're making progress, though.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts FTP Skip or ignore error and process ... AJAYREDDY All Other Mainframe Topics 3 Wed Sep 27, 2017 8:12 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am
No new posts Storing huge volume of data, compare ... Pradeep K M All Other Mainframe Topics 3 Mon Jan 16, 2017 5:08 pm
No new posts Viewing executing process in NDM .. q... Debb.Brant IBM Tools 0 Wed Dec 14, 2016 10:55 pm
No new posts Online Assembler Program Starting point Aditya.Srivastava PL/I & Assembler 4 Fri Jul 08, 2016 6:48 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us