Setting up a Print Queue on MVS 3.8j tk4 running on the Hercules mainframe emulator

Bradrico Rigg
4 min readMay 14, 2022

--

In a previous post: MVS 3.8j tk4 I showed how to setup your own mainframe emulator using Hercules and MVS 3.8j tk4 as the operating system.

We will now set up a print queue that will allow us to view the output of JCL jobs submitted to JES2 on MVS.

Requirements

These instructions are for Ubuntu Linux (I am running it on WSL2 Ubuntu) furthermore the following need to be installed:

  1. gcc — Gnu C compiler.
  2. .NET Core 6.0 SDK . Instructions for installing on Ubuntu can be found at: .Net Core We will be using Razor pages to submit and view MVS jobs.

The source code can be found at: MVSWarehouse

List of Steps

Let’s walk through the steps of how this is going to work.

  1. The Hercules System/370, ESA/390, and z/Architecture Emulator (hercules-390.eu) is included with the MVS 3.8j OS we will install. MVS will run on top of the Hercules emulator.
  2. By default, MVS directs standard out to a file for each print queue. We will intercept that standard out and send it to the standard in of a small program which will create individual files for each job we run.
  3. We will create a web app using .Net razor pages to display this content.
  4. We will also create a web page to submit JCL jobs to MVS. We can do this because MVS exposes a socket on port 3505 to submit JCL text to which is picked up by JES2 to execute.

Install MVS 3.8 j

Let’s start by installing a fresh copy of MVS 3.8j

Printer Queue Setup

Next, I have created a print queue setup tool so that output from the mvs printer will be placed in text files. (Code thanks to Tim Pinkawa (http://www.timpinkawa.net/hercules)). The setup tool’s source can be found at the git found above.

Make sure you are in your mvs38 directory and run the following which will setup the print queue and start mvs:

After a few minutes you should see the following screen and were ready to go!

Git Clone Web App for Submitting and Viewing Jobs

OK let’s git clone the source code for the print queue viewer.

After running dotnet run, the dotnet cli will build the project, and run a web server running on a local port. (your port may be different than above)

Open a web browser and go to the web address and click on the Submit Job tab:

An example jcl file is in the MVS38Pages directory. Click the choose file button and navigate to the MVS38Pages directory, choose hello.jcl then click the ‘Upload File’ button.

In the right pane, click on the submit jcl button. This will submit the job to MVS.

Click on the View Print Spool tab to view the output of the job:

Not the sexiest web design in the world but it gets the job done.

Conclusion

MVS 3.8j allows users to become familiar with mainframes and running jobs and other mainframe tasks.

Mainframes allow remote entry of jobs (via sockets and FTP) which we exploit to send jobs to MVS.

MVS sends printer output via standard out to a file. We exploit that by allowing an executable to create text files of printer output for each job that we run and we can view that output on a web page.

Final Note: Thanks to Tim Pinkawa for the source code that reads standard in from MVS.

--

--