z/OS Tools & Language

Expand all | Collapse all

Bash Shell & BPXBATCH

  • 1.  Bash Shell & BPXBATCH

    Posted 06-14-2017 12:54

    We have the 4.2.53 version of bash and are having problems with BPXBATCH when using the exec command.

    bash -version
    GNU bash, version 4.2.53(2)-release (i370-ibm-openedition)
    Copyright © 2011 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html

    If the last line of my .profile contains an exec for the bash shell
    When running a batch TMP with BPXBATCH it produces no output. (ie appears to run but just returns the READY prompt).

    This is what I ran
    //SYSTSIN DD *
    BPXBATCH SH ls -la

    Same results for PGM=BPXBATCH,PARM=(‘SH ls -la’)

    This is what is in my .profile
    exec /sysn/rs/bin/bash

  • 2.  RE: Bash Shell & BPXBATCH

    Posted 06-14-2017 21:28

    My guess is that you get no output because STDOUT and STDERR are not Unix kernal fds, and so they do not survive the exec. If instead you use PATH=/tmp/my_stderr, along with the two other keywords, to send the output to a USS file, and then add a second step to copy the results to the spool, it should work. You may need to second step to use BPXBATSL with PGM /bin/cp to ensure that the sysout DDs are available when they are needed. Or you can do it in one step (at least in this case), by using PGM /bin/ls along with BPXBATSL.

  • 3.  RE: Bash Shell & BPXBATCH

    Posted 06-15-2017 11:59

    I think it’s the fact that I am using exec in my profile if I change that to /sysn/rs/bin/bash (ie remove the exec it works)
    I am using the exec so it don’t have to exit twice.

  • 4.  RE: Bash Shell & BPXBATCH

    Posted 06-19-2017 02:54


    In your ~/.profile do:

     exec /sysn/rs/bin/bash -l