Running z/OS UNIX applications under z/OS batch
Using the BPXBATCH utility
Use the IBM-supplied BPXBATCH program to run a XL C/C++ application under z/OS® batch from a z/OS UNIX file. You can invoke the BPXBATCH utility from TSO/E, or by using JCL. The BPXBATCH utility submits a batch job and performs an initial user login to run a specified program from the shell environment.
Before you invoke BPXBATCH, you must have the appropriate authority to read from and write to z/OS UNIX files. For writing program output such as error messages, you should allocate z/OS UNIX files to stdout and stderr. Allocate the standard files using the PATH options on the TSO/E ALLOCATE command or the JCL DD statement.
For more information on the BPXBATCH program, refer to BPXBATCH utility.
Invoking BPXBATCH from TSO/E
- From the TSO/E READY prompt
- From a CALL command
- From a REXX EXEC
Figure 1 shows a REXX EXEC that does the following:
- Runs the application program /myap/base_comp from your user ID
- Directs output to the file /myap/std/my.out
- Writes error messages to the file /myap/std/my.err
- Copies the output and error data to data sets
/* base_comp REXX exec */
"Allocate File(STDOUT) Path('/u/myu/myap/std/my.out')
Pathopts(OWRONLY,OCREAT,OTRUNC) Pathmode(SIRWXU) Pathdisp(DELETE,DELETE)"
"Allocate File(STDERR) Path('/u/myu/myap/std/my.err')
Pathopts(OWRONLY,OCREAT,OTRUNC) Pathmode(SIRWXU) Pathdisp(DELETE,DELETE)"
"BPXBATCH PGM /u/myu/myap/base_comp"
"Allocate File(output1) Dataset
('MYAPPS.STD(BASEOUT)')"
"Ocopy Indd(STDOUT) Outdd(output1) Text Pathopts(OVERRIDE)"
"Allocate File(output2) Dataset('MYAPPS.STD(BASEERR)')"
"Ocopy Indd(STDERR) Outdd(output2) Text Pathopts(OVERRIDE)"
To invoke BPXBATCH, enter the name of the REXX EXEC from the TSO/E READY prompt. When the REXX EXEC completes, the files allocated to stdout and stderr are deleted.
Invoking BPXBATCH using JCL
//jobname JOB …
//stepname EXEC PGM=BPXBATCH,PARM='PGM /u/myu/myap/base_comp'
//STDOUT DD PATH='/u/myu/myap/std/my.out',
// PATHOPTS=(OWRONLY,OCREAT,OTRUNC),PATHMODE=SIRWXU
//STDERR DD PATH='/u/myu/myap/std/my.err',
// PATHOPTS=(OWRONLY,OCREAT,OTRUNC),PATHMODE=SIRWXU
Submitting a non-z/OS UNIX System Services executable to run under batch
If your program requires z/OS UNIX System Services, but has been link-edited into a load module (PDS member) or bound into a non-z/OS UNIX program object (PDSE member), it can be executed in the z/OS batch environment. Use the JCL EXEC statement to submit the executable to run under the batch environment. You must have the runtime option POSIX in effect, either as #pragma runopts(POSIX(ON)), or as PARM='POSIX(ON)/'.