S/MF
StackMF Knowledge Base • z/OS
DevOps & Automation 10 min read 2026-09-27

Automating z/OS JCL Submission, Spool Polling, and Output Retrieval via Zowe CLI in CI/CD

A
Reviewed by Anshu
Chief Technology Architect & Mainframe Systems SME
Enterprise Modernization Advisory
Google AI Overview & Featured Snippet Quick Answer

Executive Summary: Automating z/OS JCL Submission, Spool Polling, and Output Retrieval via Zowe CLI in CI/CD

Integrate mainframe batch execution into modern DevOps pipelines. Learn how to submit JCL from local Git branches, wait for completion, check return codes, and download spool outputs (SYSUDUMP, CEEDUMP) programmatically using Zowe CLI commands.

1 Problem Statement & Architecture Context: Automating z/OS JCL Submission, Spool Polling, and Output Retrieval via Zowe CLI in CI/CD

DevOps teams attempting to automate regression testing in GitHub Actions or Jenkins struggle to trigger mainframe batch jobs. Engineers resort to manual submission or flaky FTP scripts that fail to report whether the submitted batch job succeeded, timed out, or crashed with an ABEND.

2 Technical Root Cause & Architecture Mechanics

Submitting batch jobs across network boundaries requires interacting with the z/OSMF Jobs REST API.

Zowe CLI abstracts these complex HTTP calls into simple command-line invocations:

  • zowe zos-jobs submit handles dataset or local file submission.
  • The --wait-for-active and --wait-for-output flags pause execution until the job completes in JES2/JES3.
  • Return codes (CC 0000, ABEND S0C7) are captured natively as shell exit codes.

3 Implementation Guide & Modernization Strategy

# 1. Submit Local JCL and Wait for Completion

In your CI/CD runner or terminal:

bash
zowe zos-jobs submit local-file ./jcl/TESTPAY01.jcl      --wait-for-output      --view-all-spool-content

Output returns:

text
jobid:   JOB04821
jobname: TESTPAY01
status:  OUTPUT
retcode: CC 0000

# 2. Evaluate Return Code Programmatically in Bash Script

Create an automated test verification script:

bash
#!/usr/bin/env bash
set -e

echo "Submitting batch job..."
RESPONSE=$(zowe zos-jobs submit local-file ./jcl/TESTPAY01.jcl --wait-for-output --response-format-json)

JOB_ID=$(echo "$RESPONSE" | jq -r '.data.jobid')
RET_CODE=$(echo "$RESPONSE" | jq -r '.data.retcode')

echo "Job $JOB_ID completed with: $RET_CODE"

if [[ "$RET_CODE" != "CC 0000" && "$RET_CODE" != "CC 0004" ]]; then
  echo "ERROR: Batch test failed! Downloading CEEDUMP..."
  zowe zos-jobs download spool-file-by-id "$JOB_ID" 4 --file "./logs/CEEDUMP.txt"
  exit 1
fi

echo "Batch verification passed successfully!"

# 3. Download Specific Spool Datasets

Download only SYSPRINT to verify application outputs:

bash
zowe zos-jobs view spool-file-by-id JOB04821 3 > ./logs/SYSPRINT.txt

Technical Specifications Matrix

Attribute Specification
Target Environment IBM z/OS • DevOps & Automation
Key Technologies Zowe CLI, JCL, CI/CD
Delivery SLA Accelerated Sprint Delivery via StackMF Pods
Technical Reviewer Anshu, Chief Technology Architect • StackMF Architecture Pod

Production Readiness & Verification Checklist

? Frequently Asked Questions

What is the root cause of Automating z/OS JCL Submission, Spool Polling, and Output Retrieval via Zowe CLI in CI/CD? ↓
Submitting batch jobs across network boundaries requires interacting with the z/OSMF Jobs REST API.
How do you resolve Automating z/OS JCL Submission, Spool Polling, and Output Retrieval via Zowe CLI in CI/CD in production? ↓
Integrate mainframe batch execution into modern DevOps pipelines. Learn how to submit JCL from local Git branches, wait for completion, check return codes, and download spool outputs (SYSUDUMP, CEEDUMP) programmatically using Zowe CLI commands.
How can teams prevent Automating z/OS JCL Submission, Spool Polling, and Output Retrieval via Zowe CLI in CI/CD in enterprise pipelines? ↓
Always specify `--wait-for-output` in automated pipelines to prevent race conditions.

Recommended Technical Runbooks

Authoritative Reference Documentation

Official IBM manuals, Redbooks, and vendor technical advisories:

Related Topics: Zowe CLIJCLCI/CDGitHub ActionsSpool ParsingAutomation
Diagnostic Runbook Notice & Nominative Fair Use Disclaimer

This diagnostic runbook is published by StackMF Technologies LLP for educational and architectural reference only. All code snippets, JCL, and procedures are provided "AS IS" without warranty of any kind. Always test changes thoroughly in non-production sysplex environments prior to production rollout.

IBM, z/OS, CICS, Db2, IMS, RACF, and IDz are registered trademarks of International Business Machines Corporation. Broadcom, CA-7, and Endevor are trademarks of Broadcom Inc. All other trademarks belong to their respective owners and are referenced under the Nominative Fair Use Doctrine (US Lanham Act 15 U.S.C. ยง 1125 / Section 30 of the Indian Trade Marks Act, 1999) solely for technology compatibility and diagnostic identification. StackMF Technologies LLP is an independent consulting entity not affiliated with or endorsed by these vendors. View Full Legal & IP Policy →

Enterprise Advisory

Struggling with Critical Mainframe Incidents or Vendor Renewal Pressure?

StackMF deploys certified Senior Mainframe Engineers fluent in both z/OS legacy internals (COBOL, DB2, CICS, VSAM, CA-7, Endevor) and modern cloud stacks (React, Kafka, AWS, Git). Onboard dedicated pods in 48 hours or cut Broadcom licensing by 60%.