Ways to define stdin, stdout, and stderr
You can define stdin, stdout, and stderr in the following ways:
- With the The TSO/E ALLOCATE command, using the ddnames STDIN,
STDOUT, and STDERR. For example, the following command allocates the z/OS UNIX file /u/turbo/myinput
to the STDIN ddname:
ALLOCATE DDNAME(STDIN) PATH('/u/turbo/myinput') PATHOPTS(ORDONLY)
- The following command allocates the MVS™ sequential data set TURBO.MYOUTPUT to the STDOUT ddname:
ALLOCATE DDNAME(STDOUT) DSNAME('TURBO.MYOUTPUT') VOLUME(volser) DSORG(PS) SPACE(10) TRACKS RECFM(F,B) LRECL(512) NEW KEEP
- A JCL DD statement, using the ddnames STDIN, STDOUT, and STDERR
The following JCL allocates the z/OS UNIX file /u/turbo/myinput to the STDIN ddname:
//STDIN DD PATH='/u/turbo/myinput',PATHOPTS=(ORDONLY)
The following JCL allocates member M1 of a new PDSE TURBO.MYOUTPUT.LIBRARY to the STDOUT ddname and directs STDERR output to SYSOUT://STDOUT DD DSNAME=TURBO.MYOUTPUT.LIBRARY(M1),DISP=(NEW,KEEP),DSNTYPE=LIBRARY, // SPACE=(TRK,(5,1,1)),UNIT=3390,VOL=SER=volser,RECFM=FB,LRECL=80 //STDERR DD SYSOUT=*
- Redirection, using <, >,
and >> Even if stdout currently defaults to /dev/null, entering the following command from the TSO/E command prompt redirects the output of the ps -el command to be appended to the file /tmp/ps.out:
BPXBATCH SH ps -el >>/tmp/ps.out
For more information about defining the standard streams for BPXBATCH, see the detailed discussion on using BPXBATCH in the appendix of z/OS UNIX System Services Command Reference.