How to Execute Rexx Using Zowe CLI

Dan Kelosky
Zowe
Published in
3 min readJan 3, 2020

{Core} Here we’ll look at a couple of example programs written in Rexx, and show how you can invoke them from the Zowe CLI.

Rexx

Rexx is an interpreted programming language that’s commonly used within z/OS.

I won’t attempt to describe much about Rexx language itself other than to say that it is a powerful and popular language for z/OS. You can even use it make text-based games on z/OS!

A talented colleague of mine, coyote time, created a Rexx Yahtzee game to help him learn the language:

Yahtzee written in Rexx 😃

“Hello World”

To start, we’ll look at a simple Rexx program to print a message to the user. We’ll do this by creating a a data set member KELDA16.WORK.REXX(HELLO) with these contents:

A “hello world” type REXX program

Running “Hello World”

You can run this Rexx as a TSO command: tso exec 'kelda16.work.rexx(hello)'

This TSO command can be run from a traditional ISPF interface:

Running “hello world” REXX

Giving this result:

Response from running “hello world” REXX

Alternatively…

You can run this Rexx through the Zowe CLI from your workstation (Windows, Linux, or Mac) console: zowe tso issue command “exec ‘kelda16.work.rexx(hello)’” — ssm

Same result from Windows:

Run from a Windows command prompt

Using this approach, you can remotely invoke existing automation written in Rexx interactively without needing to sign into ISPF or from some modern CI/CD pipeline.

Setup

In addition to creating a zosmf profile in Zowe CLI, you may need to create a TSO profile specifying TSO attributes (like an account number) for the above command to work: zowe profiles create tso example --account #ACCT

Running Interactive Rexx

Some Rexx may be interactive in that it prompts the user for input. This type of Rexx can also be run from Zowe CLI using a few other zowe tso commands.

For example, assume we have some Rexx in KELDA16.WORK.REXX(TSOTALK):

This Rexx prompts the user (using pull) for another user’s ID to send a message to them:

Running Rexx with prompts from ISPF

Alternatively (again)…

Use Zowe CLI to:

  1. Start a TSO address space: zowe tso start as
  2. Send messages: zowe tso send as <key-here> --data command
  3. Stop a TSO address space: zowe tso stop as <key-here>

(sorry no gif):

Running Rexx with prompts from Windows

Automation

It may not be obvious, but an advantage to performing this operation through Zowe CLI is that you can automate operations more easily using the series of commands.

In an automation use case, you can set the --sko flag when you start your address space to more easily extract the TSO servlet key needed for all remaining TSO commands:

Takeaway

You can run TSO commands through Zowe CLI in a couple of ways to make use of your existing Rexx in new automation.

You can also play Chris’ Yahtzee game from Windows command prompt even though the game is running on z/OS 😃:

Rexx Yahtzee through Zowe CLI

--

--

Dan Kelosky
Zowe
Writer for

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