Zowe

Zowe is the modern open source interface for the mainframe and z/OS. The Zowe blog has how-to’s…

Follow publication

Using Zowe CLI to build and run a `Hello World` program written in High Level Assembler language.

--

{Core} My first Open Mainframe Project Zowe blog was a “Hello World”-Zowe example written 6 years ago. It covered an approach to developing IBM High Level Assembler (HLASM) with Zowe CLI.

Rereading this approach 6 years later, I’m pleased to see that the general concept is still valid. However, my original approach was too complicated!

For example:

  1. Although the “Hello World” applied to Zowe and not HLASM the sample HLASM code was over 1000 lines long
  2. Many scripts (8 in total) were needed because Zowe CLI had limited features
  3. JCL was used for build/run but it complicated deployment

Below we’ll look at a shorter, simpler version to achieve something interesting with Zowe CLI: build and run a “Hello World” HLASM program.

Less HLASM Code

Snapshot of the HLASM code found @ https://github.com/dkelosky/assembler-metal-template/blob/v6/zossrc/template.s

This new code found here is not the simplest way possible to write “hello world” in HLASM. However, it’s ~900 lines shorter than the previous example and still demonstrates mostly good techniques (although it will likely be scrutinized by an interested community 😀).

No Scripts

At the time of writing the original blog, zowe CLI didn’t have as many features as it does today. So, in order to achieve interesting operations, you typically needed to wrap multiple zowe CLI commands into a script.

Instead, we can run a handful of zowe CLI commands directly (assuming you have it installed and configured):

  • zowe ssh issue command "mkdir -p /tmp/somedir/template" — creates a location in z/OS UNIX to build & run “hello world”
  • zowe files upload dtu zossrc /tmp/somedir/template — uploads the zossrc directory and contents from a local workstation to /tmp/somedir/template
Commands run in succession from a workstation terminal

No JCL

Here we’ll use a basic makefile and run the test program under z/OS UNIX.

ASM = as
BIND = ld

template: template.o
$(BIND) -brmode=any -V -eTEMPLATE -o $@ $^ > $*.bind.lst

template.o: template.s
$(ASM) -mrent -a=$*.asm.lst -I. -o $@ $^

Note: default macro data sets (like SYS1.MACLIB) are included, but you can include others via -Isome.macro.data.set.

To build, invoke make:

  • zowe ssh issue command “cd /tmp/somedir/template && make" — switches to your z/OS UNIX source directory and runs make

To run, invoke the template program:

  • zowe ssh issue command “cd /tmp/somedir/template && make && ./template" — switches to your z/OS UNIX source directory and runs ./template
Building & running the program from a workstation terminal

Note: if you don’t see +HELLO WORLD when following along, you probably need to add export _BPXK_JOBLOG=STDERR to you z/OS UNIX .profile.

Recap

This is a starting point for using Zowe CLI to build and run simple HLASM programs. zowe files upload ... is the only command which requires z/OSMF prerequisite on your mainframe system. The remaining commands are executed via an SSH connection which is built into zowe CLI. If you don’t have access to z/OSMF, you can alternatively use ftp, sftp, or your favorite alternative to transfer files to your z/OS UNIX system.

If you enjoyed this blog checkout more Zowe blogs here. Or, ask a question and join the conversation on the Open Mainframe Project Slack Channel #Zowe-dev, #Zowe-user or #Zowe-onboarding. If this is your first time using the Open Mainframe Project Slack Channel register here.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Zowe
Zowe

Published in Zowe

Zowe is the modern open source interface for the mainframe and z/OS. The Zowe blog has how-to’s, tips & tricks and other helpful insights for mainframe devops. Zowe is a project within the Linux Foundation’s Open Mainframe Project (OMP). Download @ Zowe.org.

Dan Kelosky
Dan Kelosky

Written by Dan Kelosky

Likes programming/automation in mainframe (assembler, C/C++), distributed (Node.js), and web development (Firebase, Angular).

No responses yet

Write a response