Hello World in REXX
Your first REXX program - the classic Hello World example with Docker setup using Regina REXX
Every programming journey starts with Hello World. REXX makes this incredibly simple—the language was designed from day one to be readable and intuitive.
The Code
Create a file named hello.rexx:
| |
That’s it! Just two lines—a comment and a single say instruction.
Understanding the Code
Let’s break down this simple program:
/* Hello World in REXX */- A comment enclosed in/* */. REXX uses this C-style comment syntax exclusively (no line comments).say "Hello, World!"- TheSAYinstruction outputs text to the console. No parentheses needed, no special formatting—just the keyword and the string.
The REXX Philosophy in Action
This simple example demonstrates REXX’s core design principles:
- Minimal syntax - No
main()function, no imports, no boilerplate - English-like keywords -
saydoes exactly what the word suggests - No declarations - You don’t need to declare variables or program structure
- Case insensitive -
SAY,Say, andsayall work identically
Running with Docker
The easiest way to run REXX without installing anything locally is using Regina REXX in a Docker container:
| |
Understanding the Docker Command
docker run --rm- Run a container and remove it when done-v $(pwd):/app- Mount the current directory as/appinside the container-w /app- Set the working directory to/apprzuckerm/rexx:3.6-5.00-1- The Regina REXX Docker imagerexx /app/hello.rexx- Run the REXX interpreter with our program
Running Locally
If you have Regina REXX installed:
| |
Installing Regina REXX
macOS (Homebrew):
| |
Ubuntu/Debian:
| |
Windows: Download from Regina REXX SourceForge.
Fedora/RHEL:
| |
Expected Output
Hello, World!
Clean, simple output—exactly what you asked for!
Alternative Styles
REXX’s flexibility allows several ways to write Hello World:
Without the Comment
| |
Yes, a one-line program! REXX doesn’t require any structure for simple scripts.
Using String Concatenation
| |
The || operator explicitly concatenates strings.
Using Adjacency Concatenation
| |
REXX can concatenate strings simply by placing them adjacent to each other.
Using the Abuttal Operator
| |
Without spaces, || performs abuttal (concatenation without space).
Multi-line Output
| |
Each say produces a new line.
Key Concepts
1. SAY Instruction
The SAY instruction is REXX’s primary output mechanism:
| |
2. Comments
REXX uses /* */ for all comments:
| |
3. Case Insensitivity
REXX doesn’t care about case for keywords:
| |
Convention typically uses lowercase in modern REXX code, though uppercase was common historically.
4. Strings
Strings can use single or double quotes:
| |
The Minimal Program
Technically, the smallest valid REXX “Hello World” is:
| |
No spaces required between the keyword and the string! However, for readability, always use spaces.
A Bit of History
When Mike Cowlishaw created REXX in 1979, he was frustrated with the complexity of existing scripting languages. He wanted something that:
- A secretary could read and understand
- A programmer could write quickly
- A system administrator could maintain
The say instruction exemplifies this philosophy—it’s not print(), printf(), console.log(), or System.out.println(). It’s just say. The language says what it does.
This same program would have run on IBM mainframes in the 1980s, on Amiga computers in the late 1980s, on OS/2 desktops in the 1990s, and now in Docker containers in the 2020s. REXX’s simplicity has given it remarkable longevity.
Why Learn REXX Today?
While REXX isn’t the trendiest language, it offers:
- Mainframe relevance - If you work with z/OS, MVS, or VM/CMS, you’ll encounter REXX
- Excellent text processing - REXX’s string handling is elegant and powerful
- Historical perspective - Understanding REXX illuminates the history of scripting languages
- Easy learning curve - REXX can serve as a gentle introduction to programming concepts
Common Beginner Mistakes
Forgetting Quote Marks
| |
Using Wrong Comment Style
| |
Case Sensitivity Confusion
| |
Variable names are case-insensitive in REXX.
Next Steps
Continue to Variables and Data Types to learn about REXX’s unique approach to data handling, where everything is a string.
Running Today
All examples can be run using Docker:
docker pull rzuckerm/rexx:3.6-5.00-1