Previous topic |
Next topic |
Contents |
Contact z/OS |
Library |
PDF
Example: Running a shell command in batch z/OS UNIX System Services User's Guide SA23-2279-00 |
|
In the following example, BPXBATCH runs the shell command compress to
compress the file /usr/lib/junk. To start the next JCL job step before
the compress command completes, the parameter
string is specified as:
If, instead, the parameter string is specified as:
the
job step waits for the compress shell command
to end. For short-running commands, this is fine. 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 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. In parallel with the nohup processing, the login shell runs the sleep command. Running the sleep command delays the login shell from returning to BPXBATCH until the child process has had enough time (1 second) to protect itself from being terminated. The login shell returns to BPXBATCH, while the child process continues to run the compress command. Example: User TURBO runs the compress shell
command in batch, as follows:
Example: The following JCL is similar to the previous example
and produces equivalent results but uses PARM= to
specify the parameter string:
|
Copyright IBM Corporation 1990, 2014
|