How to create a Mainframe Lab

dilbert create a Mainframe Lab

Few months ago I was a job seeker with plenty of spare time. I gave a few Microsoft exams in order to own my MCSA certification and after that I was thinking about learning COBOL.

“Why not”, I taught, “there are plenty of well paid jobs around asking for this oldish program language”. I had a good experience with Programming for Everybody on Coursera, a fantastic course made by Charles Severnace. I later did Java Programming Masterclass for Software Developers on Udemy which is the most complete Java course you can find online.

This time I wanted to give a try to Pluralsight and the experience was pretty bad: of the 3 courses I tried:

… none of them provided “hands-on” resources or documentations; plus there were no exercises! No lab!

How are people supposed to learn without doing exercises?

So…

The problem: there are no Mainframe out there…

Mainframe lab licenseI soon discovered that there was no way you could own a Mainframe as IBM only sells Mainframes to banks. So if you are not a bank you cannot have it. That’s it.

Actually not even bank can own a Mainframe machine as IBM just stipulate a contract with the bank and the bare metal Mainframe is “rented” to the bank. The license is provided inside a laptop that lies inside the Mainframe and if it goes missing then you can bin the whole Mainframe cluster.

This way banks cannot resell Mainframes therefore there is a lack of hardware, therefore we don’t have a lab.

The maximum you can find is some vintage legacy machine that are sold at a prohibitive costs… because they are vintage, of course, and good luck finding the tape that you need in order to write the code and make them work.

The Solution: Mainframe on a Docker container

Some pious soul decided to port a virtualization of the old IBM z/OS to docker and thanks to the power of internet you can now create your own mainframe in the flavour of:

  • Hercules MVS 3.8j: Fully running MVS 3.8j Tur(n)key 4- System. IBM Mainframe. The MVS 3.8j Tur(n)key 4- System runs on an IBM 3033 mainframe emulated by the Hercules System/370, ESA/390, and z/Architecture emulator which is Copyrighted (c) by Roger Bowler and others. (more info here)
  • Hercules VM/370: vm370 Emulator with Robert O’Hara’s Six Pack. System/370 is a 24-bit architecture: 16MB (2**24) is the maximum addressible memory. System/380 is the enhanced version of the S/370 architecture created by Paul Edwards, and supported by the 380 version of the Hercules emulator, available at http://mvs380.sourceforge.net. In the SixPack you can use the S/370-XA instructions BASR and BASM to enter 31-bit mode and address storage above the 16MB line. Note that this storage is unmanaged, so only one program per Hercules “computer” can use it at a time. You can access this memory from assembler language programs or from C programs. (more info here)

How to build your Mainframe Lab

Here how to install your Mainframe Lab in a few steps. We are going for the MVS but if you prefer you can use the VM/370, the process is the same.

  1. Go ahead and download the rattydave/docker-ubuntu-hercules-mvs .

Download Mainframe Docker Image

  1. Once the Image is downloaded create the container through the wizard:

Create Mainframe Contianer

  1. After a few moments the container should be there, up and running, eating no more than 100MB of RAM

Docker running Mainframe Container

  1. If you go into Details > Log , you might actually see the logs written in COBOL. That is the proof that everything is working and somewhere there is a Mainframe terminal waiting for you. You are going to see that in a few minutes…
COBOL Mainframe Logs Docker
Every line of this log is a “stdout”: this is how you represented an image or a banner.
  1. We now need to connect a terminal to it. Forget about SSH, Linux Shell, PuTTY, PowerShell or Telnet. The only thing that can connect to a Mainframe is an IBM 3270 and, of course, you don’t have that at home. So we need to emulate that too.
    Online you ill find all sort of 3270 emulator with a 15 days trial but if you opt for a free one like me you can go for the x3270 terminal that you can install on your WSL. You can then run it with GUI following my guide.
  2. My Docker is running on my Synology NAS at the IP address 192.168.1.44. Before we move forward let’s check two things: that the ports 3270 and 8038 are setup correctly

Docker Mainfram ports

  1. and that we can reach the mainframe virtualized console at the URL http://docker.host:8038 which in my case is http://192.168.1.44:8038/
Mainframe Docker console URL
…do you remember the logs we were looking at?
  1. Cool, so now, if you have followed my guide and installed x3270 on WSL we can now connect to it:
Docker Mainframe x3270
….ta da! And here you can finally see the lines printed one by one on the terminal

From now on you can follow this tutorial about how to login with the users:

  • 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.

How it ended up

I finally didn’t follow up with the COBOL course. The reality is that even after I found a Mainframe Community to follow with a relatively active Slack chat I wasn’t really into it.

What made me ultimately drop the course was a recruiter who was offering me two positions in a bank not far away from where I live. He just told me “If you want to work in a relaxed environment just don’t opt for banks. You might be well paid but wearing a tie is still a must and your manager hardly knows what a computer is. You also need to forget about AGILE, Scrum or Prince2 methodology as the financial sector is so retrograde that still use Lean methodology which doesn’t takes in consideration the well being and growth of the employees.”

It goes by itself that you cannot listen to music while coding and there is no PlayStation and when I look for a new job I now consider a lot the presence of Friday Drinks, table tennis, pool table or any other amenity.
I mean, we are here for work right? How can you possible work well if you don’t have fun?

I lately found a job in a Service/Consulting company and I’m extremely happy with that.

Fun fact

Mainframe panicThe Millennium bug actually existed and COBOL was behind it!

When computers were taking the size of a living room or a small garden the length of the code was a problem. Of course we don’t think about that now when our computers have 1TB of hard drive but half a century ago (already, sigh!) scraping just a few bites was gold.

Still in 1980 you would have never named a variable var_which_do_stuff but simply x just to save bites. It looks crazy today but that is the reason which lead COBOL to declare the year variable in two digits this way:

YEAR PIC 99

This means there is no way to discern 1899 from 1999 or 2099.

So how did they fixed the problem?

The old way, they kicked the can down the road hoping that wouldn’t have been a problem in a 20 years time, and they treated all dates from 00 to 20, as from the 2000s.

Well, we are now in 2021 so I assume they put a second patch on the patch like I do in my son’s trousers.

May our children never forget the agony we once endured.

Related

Leave a Reply

You have to agree to the comment policy.