MOM Pt. 001: Setting up my own Mainframe!


It’s been two months since my last blog post, that’s bad! I took a break after participating in master the mainframe as it took a lot of time and energy away from me. I was not only active here on my blog but also on Slack and LinkedIn; I helped out a lot of students/enthusiasts with the challenges. But now… I’m back, alive and well.

So, I’m setting up my own mainframe today. I know I can still use the mainframe IBM has made publicly available to all Master the Mainframe contestants. But having my own mainframe is way more fun isn’t it? I can’t run z/OS as I would need a valid license.

I have two options:

  • VM/370 by IBM is the last public domain mainframe platform available.
  • MVS 3.8j Tur(n)key 4- System, no SQL available.

I will try MVS 3.8j. The only downside I really see with using one of these is that there’s no SQL-like driver available. The only good reason I have to use these systems is so I could develop COBOL and ASM directly inside a mainframe. It’s also a lot of fun!

I’ll definitely do some DB2 and COBOL later using IBM’s mainframe. I’m also unsure whether I’ll learn Java mixed with COBOL, that’s an option for the future.

So I was looking around on the internet and I stumbled upon a presentation by Jeroen Baten. He didn’t really explain how to setup a mainframe on Linux but he did give a clear statement.

So, I’ll do exactly what Mr. Baten said.

Building Hercules from source

I’ll be doing this on Debian 9, as it is the operating system I’ll be running on Hetzner (a cloud host provider). There’s only 7 simple steps to follow.

  1. Download the source code to your system using wget: wget
  2. Unzip using: tar xvzf release-3.13.tar.gz
  3. Run: ./util/bldlvlck and see which dependencies you need to install. Besides all listed dependencies you’ll also need to install g++ by issuing apt install g++. If you can’t execute the file then chmod u+x ./util/bldlvlck so you can execute the file.
  4. Then generate the configuration file using ./
  5. Then configure using ./configure.
  6. Then create the executables using make.
  7. Then install the programs as root using make install.

This should be simple right? Right? Right… Also, the reason I’m getting the files from GitHub is because the autogen script is missing from the official download link. What’s up with that?! HUH?!

But… but… there’s also apt install hercules. I like building this from source. Just because.

So I have downloaded the files and extracted it to the spinhawk-release-3.13 folder. Now I can check which utils I still need to install.

I still lack autoconf, gawk, gcc, m4, make and g++. I’ll install those using apt install autoconf gawk gcc m4 make g++. When running the check util again it gives me OK for all requirements.

This means I can now generate a configuration file.

After generating the configuration file, I can let it configure by using ./configure and then I can make and make install. This might take a while.

Libraries have been installed in: /usr/local/lib/hercules. There! It’s done!

MVS 3.8j Tur(n)key 4-

This is easier than compiling Hercules. Actually, I don’t think setting up the Hercules emulator was necessary. I did it anyway. There’s also a Docker image available, but that’s not any fun either.

There’s only a few steps to do:

  1. wget
  2. wget (optional)
  3. wget (optional)
  4. unzip and then unzip the other zip files using the -o flag. Observe the screenshot below. It’s best to do this in a different folder.
  5. ./mvs

Getting the files.

Unzipping the files.

We’re going to set the MVS OS to console mode instead of daemon mode. This enables us to issue commands without being connected using a telnet connection. This can be done by changing to the unattended directory and running the  ./set_console_mode script.

Before we start the system, there’s a few things we need to know. Let me list it for you:

  • HERC01 is a fully authorized user with full access to the RAKF users and profiles
    tables. The logon password is CUL8TR.
  • HERC02 is a fully authorized user without access to the RAKF users and profiles
    tables. The logon password is CUL8TR.
  • HERC03 is a regular user. The logon password is PASS4U.
  • HERC04 is a regular user. The logon password is PASS4U.
  • IBMUSER is a fully authorized user without access to the RAKF users and profiles
    tables. The logon password is IBMPASS. This account is meant to be used for recovery purposes only
  • The IP address of the system. In this case I don’t need to port forward, it’ll also be a local IP address. You can discover the address by issuing ip addr show inside the terminal. Then you connect to that IP address using your 3270 terminal emulator. The port is 3270, not 23.

My address in this case is and port 3270. I’ll start the mainframe OS using ./mvs.

MVS is up and running!

Connecting to my mainframe

I know, I know, I shouldn’t be using Vista TN3270. When I can, I’ll buy a copy. I’m still using the license from IBM’s Master the Mainframe challenge.

So I’m connecting to the IP above and I’ve set the IP Port to 3270.

Let’s connect!

It’s alive! Enter the LOGON command. I’ll login as HERC03 and my password is PASS4U.

Everything is now setup and I’m ready to start writing my own COBOL!

What about you?

Are you running your own mainframe? Do you want to? If you don’t like mainframes then let me know at idontlikemainframes at 

Let’s make our custom home screen in MOM part two!

11 thoughts on “MOM Pt. 001: Setting up my own Mainframe!

  1. Installed and ran MVS3.8J in 2015. Installed TK4- in 2019 and very actively using it today. These are amazing pieces of work created by some gifted people. I encourage any ex-mainframers reading this to download TK4- and give it a try. I think you will have a very pleasurable experience as your mainframe knowledge comes back to you. I run it under Ubuntu 18.04 on my Intel NUC and I’m very pleased with its reliability and performance. My current project is interfacing MVS with Linux by means of custom C code I designed for the DIAGNOSE instruction support in Hercules 4.0. So far I am able to transmit sequential files and partitioned dataset members to Linux in either text or binary form. Now working on transmitting Linux files going the other direction. Cheers

  2. Hey Kevin,
    Great blog. I’m doing something similar but as a how-to for the younger STEM audience and specifically to the Raspberry Pi. Well thank goodness for Moshix. Man that guys is a wealth of knowledge!

    Fortunately the TK4- iteration is a no-brainer to get up and running. Can’t image keeping a STEM audience interested in something so esoteric and probably not too relative to today if we had to IPL the thing from scratch and get everything init’d.

    Again, great work

    1. Hi Dave!

      Thanks for the kind words!

      I have checked out your blog and running a mainframe on a Raspberry Pi sounds awesome! Whenever I get my hands on one, I might continue the my own mainframe project on it.

      Recently a user mailed me to get resources on how a mainframe really works. Your blog seems to be going that way, I’ll keep it in mind whenever that question comes up again.

      I’m looking forward to your next posts!

      Stay safe!
      – Kevin

  3. I have used TK4- since April 2019. I have written seven COBOL programs so far. I also plan to write some programs in RPG, PL/I and C. I also use the Vista 3270 emulator.

    It is quite a rush to have my own mainframe computer.

    I have also watched some of the Moshix videos on Youtube. It is a good idea to watch several of his videos before getting started.

    I use quite a simple configuration: I use the version of Hercules contained within TK4-. I also use the system in Daemon mode. I also run the system directly under Windows 7.

    1. Hi Martin

      Indeed, watching Moshix was the only thing that got me started with my own mainframe. It would have taken me much more time to get going. It really is one of the best things to do before getting started.

      Simple configurations are the best! I wish the best for both you and your mainframe 🙂

      Kind regards,
      – Kevin

    2. Your TK4- system seems to be coming along nicely under Windows7. What IDE are you using for C? When developing C in your environment years ago I used Visual Studio, which was great. Under Linux I use KDevelop, also pretty good.

      TK4- has made it possible for me to play around with Fortran for the first time in more than 40 years. I have only a nodding acquaintance with COBOL, and haven’t tried that on TK4- yet. Routinely I run some of the MVS utilities like IEBCOPY and IEBGENER. I’ve also put together some batch jobs executing SORT. AMASPZAP comes in handy when debugging assembler code.

      Most of my TK4- time is spent developing Assembler code edited with RPF and assembled/link-edited by batch jobs. My current Assembler coding effort involves the MVS-to-Linux file transmit project I mentioned in another post. The MVS side of things is close to done. The Linux side (Hercules code enhancement in C code) was finished 5 years ago when I was running the earlier MVS3.8J. Now I’m thinking about the design for transmitting Linux-to-MVS. TK4- is pretty slick, and I love the thing. I have run into minor problems with it like someone creating a member name in SYS1.PARMLIB having a hyphen. This evidently is possble to do, but it has been verboten since the earliest days of IBM Mainframe. Maybe it is allowed under z/OS these days, I don’t know. This member caused a problem when I was using Dynamic Allocation of SYS1.PARMLIB members. I had to “code around” the issue and skip the member. So far this is the worst TK4- hiccup I’ve encountered, just a small thing. Cheers

  4. Hello Kevin,
    As far as I know there is no Enterprise COBOL version for TK4, there is old one from May 1972, the same for Assembly language, it is definitely not HLASM like on z13/14.
    I will highly recommend “moshix” channel on YouTube.
    Best Regards,

    1. Hi Marek

      Thanks for pointing that out! I changed it in my blog 🙂 I did know there were different versions but I was unsure which one was on TK4. I still have a long way to go haha.

      Moshix is great! I am subscribed to him on Youtube and I like what he does for the mainframe community.

      Kind regards

Leave a Reply

Your email address will not be published. Name, email and website not required.