3270 is terminal?
🖥🖥
With all the development in mainframe modernization, you might think that the traditional way to access the mainframe would be the first thing to go. But 3270 terminals (well, terminal emulators) are still heavily used. And you don’t have to look hard to find reasons why terminal emulators continue to be important. There is plenty of new development — including Windows Terminal, a 3270 terminal emulator for Zowe, and the focus of this article…
I’m a software engineer at IBM that does z/OS development, and I want to introduce new open-source 3270 terminal emulation software: tnz. This python library / emulator may interest you if you write software that automates 3270 terminal interactions or if you just use a 3270 terminal emulator. You may find it especially interesting if you are also familiar with UNIX/ASCII terminals.
The tnz python package is pure python code with almost no dependencies, so it runs on any platform — including z/OS! It comes with a terminal emulator called zti that, like most python applications, runs in a terminal. In this case, a UNIX/ASCII terminal (or Windows Command Prompt).
The code in the package was originally written to automate 3270 terminal interaction. During z/OS development at IBM, python scripts use this package to run hundreds of z/OS testcases for hours on end. There are plenty of other libraries out there that can do this kind of automation, but this filled a need that the others couldn’t. Some other libraries were too low-level or needed to be compiled. The main API — ati — is based on an internal IBM tool that, when combined with python, seems to hit the sweet spot. There is no need to learn another macro language. Just familiarize yourself with the tnz APIs and write python code. It also comes with a py3270/s3270 API for those that have already invested there or that are hesitant to create a dependency on a newer project like tnz.
Installing it on a system that already has Python 3.8 (or higher) is simple:
pip install ebcdic tnz
You can use zti to connect to a tn3270 host from a terminal:
zti {hostname}
If you are one of the unlucky ones that does not have the pip scripts directory in your PATH, you can use the slightly longer python command:
python -m tnz.zti {hostname}
If you are interested in automation, get started with the examples or check out the documentation in ati.py.