MainframeMaster

JCL Tutorial

JCL and DevOps

Integrating traditional JCL with modern DevOps practices for enhanced agility, reliability, and efficiency

Progress0 of 0 lessons

Bridging Two Worlds: JCL and DevOps

The mainframe world of JCL and the modern DevOps landscape may seem worlds apart, but organizations are increasingly finding ways to bring these technologies together. DevOps principles like automation, continuous integration, and version control can be applied to JCL to create more agile, reliable, and efficient mainframe operations.

Why Integrate JCL with DevOps?

  • Improved deployment speed and reliability through automation
  • Reduced risk through consistent, tested deployments
  • Better collaboration between mainframe and distributed teams
  • Enhanced visibility into the development and deployment process
  • Stronger governance with built-in compliance checks

Traditional JCL Approach

  • Manual code changes
  • Limited version control
  • Manual testing processes
  • Environment-specific JCL
  • Change control boards for approval

DevOps JCL Approach

  • Automated, templated changes
  • Git-based version control
  • Automated testing in pipelines
  • Parameterized, environment-agnostic JCL
  • Automated approvals with guardrails

DevOps for JCL doesn't mean abandoning mainframe strengths like reliability and security. Instead, it means enhancing those strengths with modern practices for increased agility and efficiency.

JCL in Continuous Integration Pipelines

Continuous Integration (CI) involves automatically building and testing code changes to detect issues early. While traditionally focused on distributed systems, CI can be extended to include JCL.

Components of a JCL CI Pipeline

Pipeline StageMainframe JCL ActivitiesCommon Tools
Source ControlStore JCL in version control systemGit for z/OS, Endevor, ChangeMan ZMF
BuildGenerate environment-specific JCL, validate syntaxJCLCheck, JCLPLUS, Zowe CLI
TestRun jobs in test environment, verify resultsZowe API, JUnit, custom test harnesses
AnalyzeCheck for coding standards, security issuesSonarQube with mainframe plugins, custom analyzers
DeliverPrepare JCL for deployment to higher environmentsUrbanCode Deploy, Jenkins with z/OS plugin

Example CI Pipeline for JCL

yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Jenkins pipeline example for JCL pipeline { agent any stages { stage('Checkout') { steps { // Get JCL from source control checkout scm } } stage('Syntax Check') { steps { // Run syntax validation using Zowe CLI sh 'zowe jobs submit lf "./jcl/syntax-check.jcl" --wait' } } stage('Generate Test JCL') { steps { // Apply test environment parameters sh 'node ./scripts/apply-test-params.js' } } stage('Execute Test Jobs') { steps { // Submit test job and capture output sh 'zowe jobs submit lf "./jcl/test-job.jcl" --wait --output-file ./results.txt' } } stage('Analyze Results') { steps { // Check job results sh 'node ./scripts/validate-job-results.js' } } stage('Deploy to QA') { when { branch 'main' } steps { // Prepare JCL for QA sh 'node ./scripts/prepare-qa-deployment.js' } } } post { always { // Store results archiveArtifacts artifacts: 'results.txt', fingerprint: true } } }

This example shows a Jenkins pipeline that checks out JCL from source control, validates syntax, generates test-specific JCL, executes the job, analyzes results, and prepares for deployment to QA if all tests pass.

Challenges and Solutions

  • Challenge: Environment dependencies
    Solution: Use parameterized JCL with environment-specific substitution
  • Challenge: Test data availability
    Solution: Implement test data management solutions with data masking
  • Challenge: Pipeline execution time
    Solution: Parallelize steps where possible, optimize job execution
  • Challenge: System resource constraints
    Solution: Schedule CI jobs during low-utilization periods, optimize resource usage

Important: Even with automation, ensure that changes to critical production JCL undergo appropriate review and validation. Automation enhances but doesn't replace sound governance processes.

Automating JCL Deployment

Automated deployment is a cornerstone of DevOps that brings consistency, reliability, and efficiency to the process of moving JCL from development to production.

JCL Deployment Automation Strategies

Templated JCL

Use base JCL templates with environment-specific parameters injected at deployment time.

jcl
1
2
3
4
5
6
7
8
9
10
11
//REPORTJB JOB (ACCT),'DAILY REPORT',CLASS=A, // MSGCLASS=X,NOTIFY=&SYSUID //* // SET ENV=%%ENVIRONMENT%% // SET DATE=%%CURRENT_DATE%% //* //STEP01 EXEC PGM=REPORTER //INPUT DD DSN=&ENV..DATA.MASTER,DISP=SHR //OUTPUT DD DSN=&ENV..REPORT.&DATE, // DISP=(NEW,CATLG,DELETE), // SPACE=(CYL,(10,5),RLSE)

Deployment Packaging

Group related JCL changes into deployment packages with dependencies and rollback instructions.

json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{ "packageId": "PAYROLL-2023-05", "description": "May 2023 Payroll System Updates", "components": [ { "name": "PAY001", "type": "JCL", "path": "/jcl/payroll/PAY001.jcl", "dependencies": ["PAYLIB"] }, { "name": "PAYRPT", "type": "JCL", "path": "/jcl/reports/PAYRPT.jcl", "dependencies": [] } ], "deployOrder": ["PAY001", "PAYRPT"], "rollbackInstructions": "..." }

Deployment Automation Tools

  • IBM UrbanCode Deploy with z/OS Extensions - Enterprise deployment automation supporting mainframe artifacts
  • BMC CD4Z (Continuous Delivery for z/OS) - Purpose-built for mainframe DevOps deployment
  • Compuware/BMC ISPW - Source code management with deployment capabilities
  • Zowe CLI & API - Open-source tools for mainframe integration
  • Jenkins with z/OS Plugin - Extended CI/CD platform with mainframe support
  • Custom Automation Scripts - Organization-specific solutions using FTP, SSH, or direct API integrations

Deployment Pipeline for JCL

A typical JCL deployment pipeline includes these key stages:

StagePurposeAutomation Activities
PreparationReady JCL for target environmentParameter substitution, dependency resolution
ValidationEnsure JCL is valid before deploymentSyntax checking, dependency validation
BackupCreate safety net for rollbackCopy existing JCL, capture current state
DeploymentMove JCL to target environmentCopy to libraries, update procedures
VerificationConfirm successful deploymentValidation tests, smoke tests
NotificationInform stakeholdersEmail, Slack, status updates

When automating JCL deployment, implement progressive deployment strategies. Start with lower environments, then move to production with appropriate approval gates. Always include rollback capabilities for when issues occur.

Testing JCL Changes

Testing JCL changes is essential to prevent issues in production. DevOps practices introduce more rigorous, automated testing approaches.

Levels of JCL Testing

  1. Syntax Validation - Checking JCL for basic syntax errors
    • Tools: JCLCHECK, JCLPLUS, IBM Batch Modernization
    • Validates statement format, parameter validity, required DD statements
  2. Static Analysis - Analyzing JCL without execution
    • Resource dependency checking
    • Standards compliance verification
    • Security and access validation
  3. Unit Testing - Testing individual jobs in isolation
    • Execute with controlled test data
    • Verify specific job outcomes
    • Mock external dependencies
  4. Integration Testing - Testing job streams and dependencies
    • Test job sequencing
    • Verify inter-job dependencies
    • Test data flows between jobs
  5. Performance Testing - Validating resource usage and timing
    • Measure execution time and resource consumption
    • Identify potential bottlenecks
    • Validate against SLA requirements

JCL Testing Automation

A key DevOps principle is automating tests to ensure consistency and enable continuous integration.

javascript
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Example Node.js script for automated JCL testing using Zowe CLI const { execSync } = require('child_process'); const fs = require('fs'); // 1. Submit JCL for testing console.log('Submitting test job...'); const jobOutput = execSync('zowe jobs submit lf "./test-jobs/PAYROLL.jcl" --wait').toString(); // 2. Extract job ID const jobIdMatch = jobOutput.match(/job id is (\w+)/i); const jobId = jobIdMatch ? jobIdMatch[1] : null; if (!jobId) { console.error('Failed to submit job'); process.exit(1); } // 3. Get job output console.log('Retrieving job output...'); execSync('zowe jobs view spool-file-by-id ' + jobId + ' --spisploc *'); // 4. Check return code const jobDetailsRaw = execSync('zowe jobs view job-status-by-jobid ' + jobId).toString(); const jobDetails = JSON.parse(jobDetailsRaw); // 5. Validate results if (jobDetails.retcode.endsWith('CC 0000')) { console.log('Job completed successfully'); // 6. Validate output datasets console.log('Validating output datasets...'); const outputCheck = execSync('zowe files list ds "PAYROLL.TEST.OUTPUT*"').toString(); if (outputCheck.includes('PAYROLL.TEST.OUTPUT.REPORT')) { console.log('Output dataset created successfully'); // 7. Further validation of content could be done here } else { console.error('Expected output dataset not found'); process.exit(1); } } else { console.error('Job failed with return code ' + jobDetails.retcode); process.exit(1); }

This example demonstrates using Zowe CLI in a Node.js script to automate JCL testing: submitting a job, retrieving output, checking return codes, and validating expected outcomes.

Test Data Management

Effective JCL testing requires appropriate test data that:

  • Represents realistic production scenarios
  • Includes edge cases and error conditions
  • Complies with data privacy regulations (masked or synthetic)
  • Remains consistent between test runs
  • Can be refreshed or reset automatically

Important: Never use actual production data containing sensitive information for testing. Implement data masking or synthetic data generation to maintain security and compliance.

Validating Test Results

For automated testing, clearly define success criteria:

  • Return codes - Expected completion codes
  • Output datasets - Existence, size, record counts
  • Content validation - Key values, totals, checksums
  • Log analysis - Absence of error messages, expected information messages
  • Resource usage - CPU time, elapsed time, I/O operations within expected ranges

JCL Version Control Strategies

Version control is fundamental to DevOps, providing history tracking, collaboration capabilities, and the foundation for continuous integration.

Modern Version Control for JCL

Traditional JCL environments often rely on library management systems, but modern approaches leverage Git-based workflows:

Traditional Approach

  • Library-based storage (PDS members)
  • Library management tools
  • Backup-based versioning
  • Manual comparison between versions
  • Local change management

Modern Git-Based Approach

  • File-based storage with Git
  • Detailed change history
  • Branching and merging capabilities
  • Built-in diff and review tools
  • Distributed collaboration

Git-Based JCL Organization

Organizing JCL in Git repositories requires thoughtful structure:

text
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
mainframe-jcl/ ├── README.md # Documentation ├── .gitattributes # Git settings for proper line endings ├── applications/ # Application-specific JCL │ ├── payroll/ │ │ ├── daily/ # Daily job streams │ │ ├── monthly/ # Monthly processing │ │ └── quarterly/ # Quarterly processing │ └── accounting/ │ ├── ... ├── utilities/ # Shared utility JCL │ ├── backups/ │ ├── maintenance/ │ └── reports/ ├── procedures/ # Cataloged procedures │ ├── standard/ │ └── specialized/ ├── templates/ # JCL templates with parameters │ ├── batch-jobs/ │ ├── reports/ │ └── data-processing/ └── config/ # Environment configuration ├── dev/ ├── test/ ├── qa/ └── prod/

Considerations for JCL in Git

  • Line Endings - Configure Git to handle mainframe line endings properly with .gitattributes
  • Character Encoding - Address EBCDIC to ASCII conversion in your workflow
  • Branching Strategy - Define a branching model (e.g., GitFlow, trunk-based) appropriate for your JCL changes
  • Synchronization - Establish processes to keep Git and mainframe libraries synchronized
  • Special Characters - Be mindful of mainframe-specific character handling

Example .gitattributes for JCL

text
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# Treat JCL files as text with specific line ending handling *.jcl text eol=lf *.JCL text eol=lf *.cntl text eol=lf *.CNTL text eol=lf # Treat REXX files as text *.rexx text eol=lf *.REXX text eol=lf # Binary files that should not be modified *.load binary *.LOAD binary *.objlib binary

When transitioning to Git for JCL, focus first on establishing proper file conversion and synchronization processes before implementing complex workflows. This ensures the integrity of your JCL throughout the transition.

JCL Change Management

Effective change management processes ensure that JCL modifications are properly controlled, documented, and implemented with minimal risk.

DevOps-Oriented Change Management

Modern JCL change management balances governance with automation:

Traditional ApproachDevOps ApproachBenefits
Manual change request formsTicket system integrated with version controlAutomated tracking, linking changes to requirements
Change approval board meetingsPull request reviews with automated checksFaster approvals, consistent review criteria
Manual impact analysisAutomated dependency and impact scanningMore thorough analysis, fewer missed impacts
Weekend deployment windowsSmaller, more frequent deploymentsReduced risk, faster time to market
Manual rollback proceduresAutomated rollback capabilitiesFaster recovery from issues

Pull Request Workflow for JCL

A pull request (PR) workflow provides structured reviews and approvals:

  1. Create branch - Developer creates feature/fix branch from main
  2. Make changes - Modify JCL files with appropriate changes
  3. Test locally - Run initial validation and testing
  4. Create PR - Submit changes for review with documentation
  5. Automated checks - CI pipeline runs validation, static analysis
  6. Peer review - Other developers review changes
  7. Address feedback - Make necessary modifications
  8. Approval - Designated approvers sign off
  9. Merge - Changes integrated to main branch
  10. Deployment - Automated deployment pipeline triggered

Example PR Template for JCL

markdown
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# JCL Change Request ## Description [Describe the purpose and scope of this JCL change] ## Related Ticket [Link to the ticket/issue in your tracking system] ## Type of Change - [ ] Bug fix - [ ] New feature - [ ] Performance improvement - [ ] Maintenance update ## JCL Files Modified - [List modified JCL files] ## Datasets/Resources Affected - [List datasets, databases, or other resources affected] ## Testing Performed - [ ] Syntax validation - [ ] Dev environment testing - [ ] Test environment validation - [ ] Performance impact assessment ## Test Results [Summarize test results, include job logs if relevant] ## Risk Assessment - Impact Level: [Low/Medium/High] - Rollback Plan: [Describe how to rollback if needed] ## Approvals Required - [ ] Technical Lead - [ ] Operations - [ ] Security (if applicable) - [ ] Business Owner (if applicable) ## Deployment Window [Specify when this should be deployed] ## Additional Notes [Any other relevant information]

Important: While automating change management, ensure compliance with regulatory requirements. Document approval workflows and maintain audit trails of all changes to satisfy auditors.

Modern JCL Development Approaches

Beyond just tools and processes, modern JCL development adopts contemporary programming practices and principles.

Infrastructure as Code (IaC)

JCL is a form of Infrastructure as Code, defining how batch workloads operate. Modern approaches:

  • Treat JCL as a first-class code artifact
  • Apply software development disciplines (review, testing, refactoring)
  • Use templates and generation for consistency
  • Parameterize environment-specific values
  • Document dependencies and intentions clearly

Template-Based JCL Generation

Using templates with parameters improves consistency and reduces errors:

Template:

jcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//{{JOB_NAME}} JOB ({{ACCOUNT}}),'{{DESCRIPTION}}', // CLASS={{JOB_CLASS}}, // MSGCLASS={{MSG_CLASS}}, // NOTIFY=&SYSUID //* // SET ENV={{ENVIRONMENT}} //* //STEP01 EXEC PGM={{PROGRAM_NAME}} //INPUT DD DSN={{ENV}}.{{INPUT_DATASET}},DISP=SHR //OUTPUT DD DSN={{ENV}}.{{OUTPUT_DATASET}}, // DISP=(NEW,CATLG,DELETE), // SPACE=({{SPACE_TYPE}},({{PRIMARY}},{{SECONDARY}})), // DCB=(RECFM={{RECFM}},LRECL={{LRECL}}, // BLKSIZE={{BLKSIZE}})

Configuration:

json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{ "dev": { "JOB_NAME": "DEVJOB", "ACCOUNT": "DEV#ACCT", "DESCRIPTION": "DEVELOPMENT JOB", "JOB_CLASS": "A", "MSG_CLASS": "X", "ENVIRONMENT": "DEV", "PROGRAM_NAME": "TESTPGM", "INPUT_DATASET": "TEST.INPUT", "OUTPUT_DATASET": "TEST.OUTPUT", "SPACE_TYPE": "CYL", "PRIMARY": "10", "SECONDARY": "5", "RECFM": "FB", "LRECL": "80", "BLKSIZE": "27920" }, "prod": { "JOB_NAME": "PRODJOB", "ACCOUNT": "PROD#ACCT", "DESCRIPTION": "PRODUCTION JOB", "JOB_CLASS": "P", "MSG_CLASS": "A", "ENVIRONMENT": "PROD", "PROGRAM_NAME": "PRODPGM", "INPUT_DATASET": "LIVE.INPUT", "OUTPUT_DATASET": "LIVE.OUTPUT", "SPACE_TYPE": "CYL", "PRIMARY": "50", "SECONDARY": "20", "RECFM": "FB", "LRECL": "80", "BLKSIZE": "27920" } }

Modular JCL Design

Breaking JCL into reusable components improves maintainability:

  • Use cataloged procedures for common operations
  • Create libraries of standard JCL fragments
  • Implement INCLUDE statements for shared components
  • Use symbolic parameters for flexibility
  • Document interfaces between components

Pipeline Integration Tools

Several tools help integrate JCL with modern development pipelines:

  • Zowe CLI - Open-source command-line interface for z/OS
  • z/OSMF REST APIs - IBM's RESTful services for z/OS management
  • Jenkins z/OS Plugin - Jenkins integration for mainframe
  • BMC AMI DevOps - Mainframe DevOps automation platform
  • Compuware Topaz - Modern interface for mainframe development
  • Micro Focus Enterprise Suite - Mainframe application modernization

Modern JCL development bridges traditional mainframe strengths with contemporary DevOps practices. This hybrid approach allows organizations to maintain the reliability of mainframe systems while gaining the agility of modern development methodologies.

Practical Exercises

Apply your understanding of JCL and DevOps with these practical exercises:

Exercise 1: Create a Parameterized JCL Template

Convert the following JCL into a template with parameterized values:

jcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//PAYROLL JOB (ACCT#),'PAYROLL PROCESS',CLASS=A, // MSGCLASS=X,NOTIFY=USER01 //* //STEP01 EXEC PGM=PAYRUN //SYSPRINT DD SYSOUT=* //INPUT DD DSN=PROD.PAYROLL.INPUT,DISP=SHR //OUTPUT DD DSN=PROD.PAYROLL.OUTPUT, // DISP=(NEW,CATLG,DELETE), // SPACE=(CYL,(50,10)), // DCB=(RECFM=FB,LRECL=200,BLKSIZE=0) //CONFIG DD DSN=PROD.PAYROLL.CONFIG,DISP=SHR //* //STEP02 EXEC PGM=PAYRPT //SYSPRINT DD SYSOUT=* //INPUT DD DSN=PROD.PAYROLL.OUTPUT,DISP=SHR //REPORT DD SYSOUT=A

Task: Create:

  1. A parameterized JCL template
  2. Configuration files for DEV, TEST, and PROD environments
  3. A simple script (in a language of your choice) to generate environment-specific JCL

Exercise 2: Design a JCL CI/CD Pipeline

Design a continuous integration pipeline for JCL changes:

Task: Create a detailed pipeline design that includes:

  1. Repository structure for JCL
  2. Branching strategy
  3. Pipeline stages with specific tasks at each stage
  4. Required tools and technologies
  5. Approval gates and quality checks
  6. Deployment strategy

Create a flowchart or diagram to represent your pipeline visually.

Exercise 3: Create a JCL Testing Framework

Develop a simple framework for automated JCL testing:

Task: Design and document:

  1. Test data generation approach
  2. JCL validation methods
  3. Success criteria definition
  4. Test result collection and reporting
  5. Test automation script (pseudo-code or actual code)

Focus on practical implementation that could work in a real mainframe environment.

Summary

Integrating JCL with DevOps practices bridges traditional mainframe strengths with modern development approaches:

  • JCL can be fully integrated into continuous integration pipelines
  • Automated deployment brings consistency and reliability to JCL changes
  • Rigorous, automated testing reduces risk and improves quality
  • Modern version control provides better tracking and collaboration
  • DevOps-oriented change management balances governance with agility
  • Template-based, modular JCL design improves maintainability

While implementing DevOps for JCL presents challenges, the benefits are substantial: faster delivery, improved quality, better collaboration, and enhanced visibility. Organizations that successfully integrate JCL with DevOps gain competitive advantages through more responsive, reliable mainframe operations.

The journey to JCL DevOps is incremental. Start with version control, then add automated testing, followed by deployment automation. Each step provides benefits, and the cumulative effect transforms mainframe operations while preserving the stability that makes mainframes essential to enterprise computing.

Test Your Knowledge

1. Which DevOps principle is most directly related to JCL version control?

  • Infrastructure as Code
  • Continuous Monitoring
  • Microservices Architecture
  • Immutable Infrastructure

2. What is a key challenge when implementing continuous integration for JCL?

  • JCL has too many statements to parse
  • Environment dependencies and testing constraints
  • JCL is incompatible with Git
  • Mainframes cannot support CI/CD pipelines

3. Which tool can be used to convert JCL to a more DevOps-friendly format?

  • Jenkins with z/OS plugin
  • Docker containers
  • Zowe CLI
  • All of the above

4. What is the recommended approach for testing JCL changes in a DevOps pipeline?

  • Test in production during off-hours
  • Skip testing for minor changes
  • Automated tests in isolated environments
  • Manual testing only

5. Which statement about modern JCL development is FALSE?

  • JCL can be stored in Git repositories
  • JCL cannot be integrated with modern CI/CD tools
  • JCL changes can be automatically validated
  • JCL can be generated dynamically from templates

Frequently Asked Questions