You can also do it like this:

//MODIFIED EXEC PGM=BPXBATCH
//STDIN    DD DUMMY
//STDPARM  DD *
SH set -x ;
*some commands that produce output go here;*
//STDOUT DD PATH='/tmp/output.txt',PATHOPTS=(OWRONLY,OCREAT,OTRUNC),
//             PATHMODE=SIRWXU,FILEDATA=TEXT
//STDERR DD PATH='/tmp/output.txt',PATHOPTS=(OWRONLY,OCREAT,OTRUNC),
//             PATHMODE=SIRWXU,FILEDATA=TEXT
//*-------------------------------------------------------------
//PRINT    EXEC PGM=IEBGENER
//SYSIN    DD DUMMY
//SYSUT1   DD PATH='/tmp/output.txt',
// PATHOPTS=(ORDONLY),
// PATHDISP=(DELETE,DELETE),
// RECFM=VB,LRECL=1024,BLKSIZE=3000
//SYSPRINT DD SYSOUT=*
//SYSUT2   DD SYSOUT=*

On Tue, 22 Apr 2025 at 23:43, Kirk Wolf <[email protected]> wrote:

> I think that this does what you are asking:
>
> //SHELL   EXEC PGM=BPXBATCH,
> //        PARM='SH dig coztoolkit.com 2>&1'
> //STDOUT  DD SYSOUT=*
> //
>
> FWIW:  If you use COZBATCH, it handles this automatically.  See:
> https://coztoolkit.com/docs/cozbatch/ref.html
>
> //UNIX  EXEC PGM=COZBATCH
> //STDIN DD *
> dig coztoolkit.com
> //
>
> Kirk Wolf
> Dovetailed Technologies
> https://coztoolkit.com
>
> On Tue, Apr 22, 2025, at 7:05 AM, Mark Regan wrote:
> > I'm using the OMVS DIG command in a BPXBATCH job, and I would like to
> > combine the STDOUT DD and the STDERR DD into one SYSOUT DD, or both into
> a
> > single file. I need to keep the resulting output in the order it
> executes,
> > like when you do it from the OMVS command line. Is that double? If so,
> how?
> >
> > Regards,
> >
> > Mark Regan, K8MTR General, EN80
> > CTO1 USNR-Retired (1969-1991),
> > Nationwide Insurance, Retired (1986-2017),
> > z/OS Network Infrastructure Engineering Consultant
> >
> > ----------------------------------------------------------------------
> > For IBM-MAIN subscribe / signoff / archive access instructions,
> > send email to [email protected] with the message: INFO IBM-MAIN
> >
>
> ----------------------------------------------------------------------
> For IBM-MAIN subscribe / signoff / archive access instructions,
> send email to [email protected] with the message: INFO IBM-MAIN
>

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to