Writing Python on one of the world's most powerful and secure computing platforms β IBM Mainframe (z/OS). This is not your average "Hello World" exercise. This is enterprise-grade Python development on the same infrastructure that processes $10 trillion in daily financial transactions globally.
Think of it this way: your laptop handles maybe a few dozen tasks at once. A mainframe handles millions of transactions per second β the kind of horsepower that runs your bank, your airline booking system, your hospital records. IBM's z/OS is the operating system powering these machines.
The fact that I can write, debug, and deploy Python on one? That is a rare skill that the vast majority of developers β even senior ones β do not have.
- π― What This Project Is
- ποΈ The Environment Setup
- π Programs Built
- π How the Programs Work
- πΊοΈ Program Flow Diagrams
- π Security Features
- π οΈ Tech Specs
- π Concepts Mastered
- πͺ Step-by-Step Journey
- π‘ Why This Matters to Your Team
This is Challenge CODE1 from the IBM Z Xplore Fundamentals certification track. The objective: write Python programs that run directly on an IBM z/OS mainframe β the backbone of global banking, finance, healthcare, and government infrastructure.
| π Detail | βΉοΈ Info |
|---|---|
| Challenge | CODE1 β Make Your Own Fun |
| Platform | IBM Z Xplore |
| Operating System | IBM z/OS (Unix System Services β USS) |
| Language | Python 3 |
| Estimated Duration | ~120 minutes |
| Total Steps | 12 |
| Edition | 240630-2221 |
| Prerequisite | VSC1 (VSCode remote connection to z/OS) |
To run Python on a mainframe, you can't just open a terminal and type. The full stack looks like this:
Your Computer (Windows / Mac / Linux)
β
β π SSH β Encrypted Secure Shell Tunnel
βΌ
IBM z/OS Mainframe
β
βββ USS Shell (Unix-like terminal running inside z/OS)
βββ VSCode (Connected remotely via SSH extension)
βββ Python 3 (Interpreter running natively on z/OS)
βββ JCL Engine (Batch job submission & validation)
SSH acts like a private, encrypted phone line between your machine and the mainframe β every keystroke is secured end-to-end.
| π File | π Description | π§© Concepts Used |
|---|---|---|
code1.py |
System awareness script β reads userid, checks time, counts down from 5 | Imports, time module, loops, os module |
code2.py |
Letter detective β checks whether a letter exists inside a word | Variables, if/else, string membership test |
marbles.py |
Marble countdown simulator with visual asterisk output and low-marble warning | while loop, conditionals, string slicing, arithmetic |
This was the first program to run. It demonstrates how Python can interact with the z/OS operating system itself.
import os
import time
# Counts backwards from 5
for i in range(5, 0, -1):
print(i)
time.sleep(1)
# Reads your mainframe userid
print("Hello,", os.environ.get('USER'))
# Figures out what time it is
print("The time is:", time.strftime("%H:%M:%S"))Plain English: "Count from 5 to 1, pause a second between each number, then greet the user by their actual mainframe login name and tell them the current time."
This program checks whether a specific letter appears inside a given word β illustrating variables and decision-making.
the_letter = "z"
the_word = "pizza"
if the_letter in the_word:
print(f"Yes! '{the_word}' contains the letter '{the_letter}'")
else:
print(f"Nope. '{the_word}' does not contain '{the_letter}'")Plain English: "Does 'pizza' contain the letter 'z'? If yes β say so. If no β say that instead."
π‘ The key insight: Changing
the_wordfrom"pumpkin"(no z) to"pizza"(has a z) shows how one small variable change completely changes program behaviour.
This is the centrepiece of the challenge β built step by step across multiple lessons.
marbles = 10
marble_dots = "**********"
while marbles > 0:
print("There are", marbles, "marbles left")
print(marble_dots[:marbles]) # Visual bar β shrinks each loop
if marbles <= 3:
print("WARNING: Running low on marbles!")
marbles = marbles - 1 # Remove one marble
print("You are all out of marbles")Sample Output:
There are 10 marbles left
**********
There are 9 marbles left
*********
There are 8 marbles left
********
...
There are 3 marbles left
***
WARNING: Running low on marbles!
There are 2 marbles left
**
WARNING: Running low on marbles!
There are 1 marbles left
*
WARNING: Running low on marbles!
You are all out of marbles
flowchart TD
A([Start Program]) --> B[Set the_letter to z]
B --> C[Set the_word to pizza]
C --> D{Is the_letter found inside the_word?}
D -- Yes --> E[Print: the_word contains the letter]
D -- No --> F[Print: the_word does NOT contain the letter]
E --> G([End])
F --> G
flowchart TD
A([Start]) --> B[Set marbles = 10]
B --> C{Is marbles greater than 0?}
C -- No --> H([Print: You are all out of marbles - End])
C -- Yes --> D[Print: number of marbles remaining]
D --> E[Print asterisks equal to marble count]
E --> F{Is marble count 3 or fewer?}
F -- Yes --> G[Print WARNING message]
F -- No --> I[Subtract 1 from marbles]
G --> I
I --> C
flowchart LR
A([SSH into z/OS]) --> B[Open VSCode]
B --> C[Edit Python file]
C --> D[Save changes]
D --> E[Run in USS terminal]
E --> F{Output correct?}
F -- No --> C
F -- Yes --> G[Submit CHKCODE JCL job]
G --> H([Challenge Complete])
flowchart LR
S1[Steps 1-2\nRun and Read code1.py] --> S2[Step 3\nVSCode Configuration]
S2 --> S3[Steps 4-5\nVariables in code2.py]
S3 --> S4[Steps 6-7\nif and else Logic]
S4 --> S5[Step 8\nwhile Loops in marbles.py]
S5 --> S6[Step 9\nDebugging Broken Logic]
S6 --> S7[Step 10\nAsterisks Visual Output]
S7 --> S8[Step 11\nFinal Message]
S8 --> S9[Step 12\nSubmit and Validate]
This project does not run on just any server β it runs on IBM z/OS, which has security baked in at every layer of the stack.
| π Security Layer | βοΈ What It Does | π― Why It Matters |
|---|---|---|
| SSH Encryption | All traffic between your computer and the mainframe is fully encrypted | No one can intercept your code or credentials in transit |
| RACF Authentication | IBM's Resource Access Control Facility controls who can access what resource | Only authenticated, permissioned users can execute programs |
| User Identity Binding | code1.py reads the actual mainframe userid at runtime |
Every action is tied to a real person β full audit trail |
| JCL Batch Validation | The CHKCODE validation runs as a controlled JCL job | Execution happens in a sandboxed, logged environment |
| Hardware Isolation | z/OS runs on dedicated mainframe hardware | No shared-VM attack surface β enterprise-grade isolation |
| No Extension Risks | Unnecessary VSCode extensions were intentionally avoided | Reduces the risk of third-party code executing on a secure system |
sequenceDiagram
participant Dev as Developer
participant SSH as SSH Encrypted Tunnel
participant zOS as IBM z/OS Mainframe
participant RACF as RACF Auth System
participant PY as Python 3 Runtime
Dev->>SSH: Connect with mainframe credentials
SSH->>zOS: Encrypted handshake
zOS->>RACF: Validate user identity
RACF-->>zOS: Access granted
zOS-->>Dev: USS Shell session opened
Dev->>PY: python3 marbles.py
PY->>zOS: Read userid and system clock
PY-->>Dev: Program output displayed
Dev->>zOS: Submit CHKCODE JCL job
zOS-->>Dev: Validation result returned
graph TD
A[Developer Workstation] --> B[Visual Studio Code]
B --> C[SSH Remote Extension]
C --> D[IBM z/OS Mainframe]
D --> E[USS - Unix System Services]
E --> F[Python 3 Interpreter]
F --> G[code1.py]
F --> H[code2.py]
F --> I[marbles.py]
D --> J[JCL - Job Control Language]
J --> K[CHKCODE Validation Job]
K --> L[Pass or Fail Result]
| π§© Component | π Version / Detail |
|---|---|
| Programming Language | Python 3.x |
| Operating System | IBM z/OS (USS layer) |
| Code Editor | Visual Studio Code with Remote SSH |
| Connection Protocol | SSH β Secure Shell |
| Validation Mechanism | JCL (Job Control Language) batch job |
| Authentication System | IBM RACF |
| Challenge Identifier | CODE1 / 240630-2221 |
| Certification Program | IBM Z Xplore Fundamentals |
| π§© Concept | π Used In | π What It Does |
|---|---|---|
| Variables | code2.py, marbles.py |
Named containers that hold data β numbers, words, anything |
if Statement |
code2.py, marbles.py |
Makes the program take a different path based on a condition |
else Clause |
code2.py |
Handles the outcome when the if condition is NOT true |
while Loop |
marbles.py |
Repeats a block of code for as long as something is true |
| String Slicing | marbles.py |
marble_dots[:n] β prints exactly n asterisks from a string |
| Arithmetic | marbles.py |
marbles = marbles - 1 β subtracts one per loop |
import Statements |
code1.py |
Loads Python libraries like time and os |
| Comments | All files | Lines starting with # β ignored by Python, explain intent to humans |
| Debugging | marbles.py |
Identifying and fixing a broken if condition (Step 9) |
graph TD
V[Variables] --> IF[if Statements]
IF --> ELSE[else Clauses]
ELSE --> W[while Loops]
W --> S[String Slicing]
S --> D[Debugging Logic]
D --> F[Full Working Program]
V --> W
F --> J[JCL Validation and Submission]
| # | π Step Title | π What Happens |
|---|---|---|
| 1 | IF You Want to Code⦠| SSH into z/OS, copy code1.py from /z/public, run it for the first time |
| 2 | Let's See What's Inside | Open the code in VSCode, read through imports, countdown loop, and userid reader |
| 3 | A Word on Extensions | Configure VSCode correctly β avoid extensions that break on z/OS Python |
| 4 | A Rose by Any Other Name | Learn what variables are by reading code2.py with the_word = "pumpkin" |
| 5 | A Bit of an Anticlimax? | Change the_word to "pizza" β program now outputs a result for the first time |
| 6 | Blocks for the Better | Understand if statements, colons, and indentation (the "blocks" of logic) |
| 7 | Or Else!! | Uncomment the else block β program now handles both letter-found and not-found |
| 8 | Don't Lose Your Marbles | Run marbles.py, understand how a while loop counts from 10 down to 1 |
| 9 | The Final Countdown | Enable and then fix a broken if condition β real debugging experience |
| 10 | I'm a Visual Learner | Add print(marble_dots[:marbles]) β visual asterisk bar shrinks each iteration |
| 11 | All Out of Marbles | Add "You are all out of marbles" β once, at the end, after the loop exits |
| 12 | Double-Check; Submit | Run the CHKCODE JCL validation job from ZXP.PUBLIC.JCL β challenge complete |
Here is the honest truth: most developers have never touched a mainframe. I have. And I did not just run someone else's script β I wrote Python from scratch on z/OS, debugged broken logic, and validated my work through IBM's JCL batch job system.
| β Skill | π¬ Evidence |
|---|---|
| Mainframe Fluency | Navigated z/OS USS, SSH authentication, and JCL submission β most devs cannot do this |
| Cross-Platform Thinking | Understood that Python is Python regardless of whether it runs on a laptop or a mainframe |
| Debugging Under Constraints | Step 9 required finding and fixing broken conditional logic β not just copy-pasting |
| Security Awareness | Operated in an environment where RACF, SSH tunnels, and audit trails are the baseline |
| Enterprise Toolchain | Used VSCode remote SSH, JCL batch jobs, and mainframe job monitoring together |
| Structured Learning | Completed a 12-step IBM-certified challenge with a time-boxed deliverable |
graph TD
A[IBM Z Xplore CODE1 Completed] --> B[Python Fundamentals on z/OS]
B --> C[Understands Enterprise Infrastructure]
C --> D[Bridge Between Modern Cloud and Legacy Mainframe]
D --> E[Valuable in Banking, Insurance, Government, Healthcare]
E --> F[Rare Skill - Most Developers Do Not Have This]
F --> G[That Developer Is Me]
π¬ "The world runs on mainframes. The best engineers speak both languages β modern cloud AND enterprise iron. I speak both."
This challenge is part of the official IBM Z Xplore Fundamentals learning path β a program created by IBM to bring modern developers into enterprise mainframe computing.
| Field | Detail |
|---|---|
| Issued by | IBM |
| Program | IBM Z Xplore |
| Track | Fundamentals |
| Challenge | CODE1 β Make Your Own Fun |
| Edition | 240630-2221 |
| Copyright | IBM 2021-2024 |
Built with π Python Β· Deployed on π₯οΈ IBM z/OS Β· Validated via βοΈ JCL
If you are building a team that needs someone who can bridge modern development with enterprise infrastructure β let's talk.