Hello World in 370 Assembler

What happens when coding stick meets coding_pad? It’s been well over 25 years that I wrote any assembler code. But I ran across this pad of coding sheets in a closet and I had this urge to use it. Of course I don’t have a mainframe to test it, but it can’t be wrong. Can it?

This is a minimally useful 370 assembler program.

Hello World Coding Sheet

There are only five lines of code that implement the app and the rest are just housekeeping that all programs must do. It opens an output dataset, writes a line to it and closes it. The Job Control Language (JCL) required to run this program binds the DDNAME of the output file to the DCB coded in the program. This could be routed to a file but most likely it would be spooled to a system printer. Using a WTO instead of a file write would be even simpler but you know how angry the operators get when you write useless crap to their console.

To digress a bit, the classic hello-world.c program is a few lines shorter.

#include <stdio.h>
int main() {
   printf("Hello, World!");
   return 0;

Mostly this is because of the include file stdio.h but also because the C runtime always opens three files sysout, syserr and sysin before the main program gets control. The mainframe environment is a lot more complex but much of this complexity is managed through JCL. While JCL is a hefty learning curve for a simple program like Hello World, it greatly simplifies the task of running complex programs. ‘Nuff said.

So I can’t assemble and test it but can I get it punched to cards? That would make my day.

I found this wonderful web site, The Virtual Keypunch that recreates the functionality of a keypunch machine. There is a subpage that takes an input set of instructions in various languages and creates a virtual deck of punch cards. So I went to this subpage, selected the Card Type: SYMBOLIC, and pasted the above code into a text box (no they don’t take coding sheets) and got back a "deck" of PNG image files. Each file contains one punch card with all the right holes punched as Herman Hollerith intended.

A Punched Card

Now if only I could assemble and execute this code as a reality check. I haven’t written assembler code for decades. But I miss it. The Virtual Keypunch does have processors for some languages but not for 370 Assembler. However, there is this and this. Rabbit holes for another day.

Leave a Reply

Your email address will not be published. Required fields are marked *