Tipps & TricksWissen

When using IBM’s Mainframe Emulator zPDT (or zD&T or zUD&T or however it might be called) there is that one erratic and annoying problem that most of us stumble upon every once in a while — Losing connection to your Master Console. May it be because you lost connection because you are not physically attached to the Linux System zPDT is running on and lose network connection or simply because you accidetally closed the terminal window.

Even IBM’s zPDT Guide and Reference talks about that issue in an own chapter (12.16) — but in our experience the attempt via HMC hardware console command was not quite reliable. It simply often did not work.

Thatswhy we thought about solving the problem using not Mainframe utility and methods but leveraging the extensive Linux Toolbox available.

And we came to a surprisingly stable yet incredibly simple soution, that mainly consist of one standard linux tool: a unix shell session manager called screen.

With screen you can make sure that running processes that are dependent on your current shell session will not be terminated when you close or disconnect your shell client. This means you simply close or leave the session running your Master Console and it will keep running in a “detached” screen session. The only change to the usual setup and look&feel that you know from the redbooks is that we used c3270 instead of x3270 as the terminal client because screen works on the command line (Or at least we did not research similar graphical behavior becaue we are totally satisfied with the c3270 solution). So what is to do?

When starting zPDT and IPL’ing simply don’t start x3270 to establish the mstcon but c3270. In our start/IPL script it looks like this (I highlighted the magic line):

if pgrep emily; then
echo "zPDT is already running"
exit 0
fi

awsstart aproflm    # "aproflm" being the device map we use
screen -dmS mstcon bash -c "c3270 -port 3270 mstcon@localhost -reconnect"
ipl a80 parm 0a82AL
echo "To attach to the master console use:"
echo "screen -d -r mstcon"

So what is your usual way to get to the c3270 terminal containing Master Console? It’s as easy as:

  • Remote connect to the Linux System hosting your zPDT.
  • Issue
screen -d -r mstcon

 … and that’s about it! You can simply disconnect from your remote session (e.g. close the ssh session) or just close your ssh client as soon as you’re done. Just don’t manually disconnect your c3270 terminal from the mainframe. This would be the only unpreventable way to lose connection to the Master Console.

https://www.gnu.org/software/screen/manual/screen.html